Page 1 of 1

Function To Tell What Icons are Selected in Workbench Windows

Posted: Mon Apr 24, 2023 7:01 pm
by NathanH
Hi,

I would like to see a function that returns a table of files that are selected in the currently active workbench window. For example, if I have a drawer of text files open on the workbench screen it would tell me which window is active and which files are selected/highlighted so that I could do something like open them in a text editor, copy them, delete them, etc. I imagine that this functionality could be useful on Windows/Linux/etc. as well.

NathanH

Re: Function To Tell What Icons are Selected in Workbench Windows

Posted: Thu Apr 27, 2023 6:00 am
by PEB
You can try out this code. It isn't the best solution, and it only works on Amigas using ARexx, but at least it's something.

Code: Select all

@DISPLAY {Hidden=True}

DebugPrint("You have 10 seconds to select some icons.")

Wait(10000, #MILLISECONDS)

DebugPrint("These are the icons you selected:")

ActiveWindow$=SendRexxCommand("WORKBENCH", "options results\nGETATTR WINDOWS.ACTIVE\nreturn result")

IconNum=ToNumber(SendRexxCommand("WORKBENCH", "options results\nGETATTR WINDOW.ICONS.SELECTED.COUNT NAME '\""..ActiveWindow$.."\"'\nreturn result"))

For i=0 To IconNum-1
	res$=SendRexxCommand("WORKBENCH", "options results\nGETATTR WINDOW.ICONS.SELECTED."..i..".NAME NAME '\""..ActiveWindow$.."\"'\nreturn result")
	DebugPrint(ActiveWindow$.."/"..res$)
Next

Re: Function To Tell What Icons are Selected in Workbench Windows

Posted: Thu Apr 27, 2023 5:16 pm
by NathanH
Thanks PEB,

I love the Workbench port functionality on OS3.9+ and have used it quite a bit using AREXX. Your code is a great solution for using it with Hollywood. I try to do stuff for AROS too, though and it's based upon OS 3.1 so doesn't have the Workbench port. That's why I was hoping that a function could be written so all the Hollywood targets could have this functionality. Thanks for your help!

NathanH