How do i get the path of a selected icon ?

7 posts / 0 new
Last post
JosDuchIt
JosDuchIt's picture
Offline
Last seen: 8 years 1 week ago
Joined: 2012-01-08 20:57
How do i get the path of a selected icon ?

Not much to add to the title: don't find the needed function

thomas
thomas's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-05-16 14:23
Not much to add to the title:

Not much to add to the title:

Actually there is a lot to add. What do you want to get from where?

Ami603
Ami603's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2011-10-11 23:11
Have a look at

Have a look at workbench.library/WhichWorkbenchObject()

hit = IWorkbench->WhichWorkbenchObject(NULL,
AppScreen->MouseX,
AppScreen->MouseY,
WBOBJA_DrawerPath,&DrawerPath,
TAG_END);
switch(hit)
{
case WBO_DRAWER:
case WBO_NONE:
case WBO_ICON:
.....

JosDuchIt
JosDuchIt's picture
Offline
Last seen: 8 years 1 week ago
Joined: 2012-01-08 20:57
@Ami603 workbench.h #define

@Ami603
workbench.h
#define WBO_ICON (2) /* An icon is found at these coordinates */

the function does not provide the path.
@Thomasrapp
I try to make a "project" manager putting selections of icons on the WB screen & putting them away later, replacing them with an other selection
It could be that say 2 notepad documents with same title appear on the WB screen, one part of the slection i want to put away, the other having to stay there.
Selecting them in turn with WB arexx script aan having access to their path would permit to put away the correct onen and leave the other.on the WB

Ami603
Ami603's picture
Offline
Last seen: 6 years 7 months ago
Joined: 2011-10-11 23:11
WBOBJA_Name (STRPTR) -- Get

WBOBJA_Name (STRPTR) -- Get the name of the icon, as currently
displayed by Workbench. The name will be copied into the
buffer whose address you supply with this tag. The name
will be truncated if its length exceeds the buffer size
specified with WBOBJA_NameSize.

WBOBJA_NameSize (ULONG) -- Specify the size of the buffer
passed with WBOBJA_Name, in bytes. Defaults to 64.

WBOBJA_FullPath (STRPTR) -- Get the full path of the object
the icon belongs to. If this is not available/applicable
(such as for AppIcons) an empty string will be returned.
The path will be copied into the buffer whose address you
supply with this tag. The path will be truncated if its
length exceeds the size specified with WOBJA_FullPathSize.

WBOBJA_FullPathSize (ULONG) -- Specify the size of the buffer
passed with WBOBJA_FullPath, in bytes. Defaults to 512.

WBOBJA_DrawerPath (STRPTR) -- Get the path of the drawer whose
window is found at the specified coordinates. In the case
of the Workbench root window, such a path is not available
and an empty string will be returned. The path will be
copied into the buffer whose address you supply with this
tag. The path will be truncated if its length exceeds the
buffer size specified with WBOBJA_DrawerPathSize.

WBOBJA_DrawerPathSize (ULONG) -- Specify the size of the buffer
passed with WBOBJA_DrawerPath, in bytes. Defaults to 512.

...

salass00
salass00's picture
Offline
Last seen: 6 months 2 weeks ago
Joined: 2011-02-03 11:27
You can get a list of the

You can get a list of the selected icons using WBCTRLA_GetSelectedIconList tag with the WorkbenchControl() function. To free it when you are done use the same function and WBCTRLA_FreeSelectedIconList tag. More information in the workbench.doc autodoc.

This code should work (untested):

  1. struct List *iconlist = NULL;
  2. IWorkbench->WorkbenchControl(NULL, WBCTRLA_GetSelectedIconList, &iconlist, TAG_END);
  3. if (iconlist != NULL) {
  4. struct Node *iconnode;
  5. iconnode = IExec->GetHead(iconlist);
  6. while (iconnode != NULL) {
  7. IDOS->Printf("%s\n", iconnode->ln_Name);
  8. iconnode = IExec->GetSucc(iconnode);
  9. }
  10. IWorkbench->WorkbenchControl(NULL, WBCTRLA_FreeSelectedIconList, iconlist, TAG_END);
  11. }
JosDuchIt
JosDuchIt's picture
Offline
Last seen: 8 years 1 week ago
Joined: 2012-01-08 20:57
@Ami603 Sorry to have

@Ami603
Sorry to have reacted too soon: & thank you very much
@salass00 thanks too, very helpfull

Log in or register to post comments