14 February 2016, 08:02 | #1 |
BoingBagged
Join Date: Aug 2007
Location: The South of nowhere
Age: 46
Posts: 2,358
|
ARexx help for a workbench menu action
Hi, I have set a workbench menu item with Toolsdaemon, and I want it to open the current workbench selected file with c:ed. I know this can be done with an ARexx script, but I dont know how
I would really apreciate if someone could help me, as ARexx is chinese for me |
14 February 2016, 14:48 | #2 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,303
|
That should be feasible with GETATTR command (have a look at ARexx.doc) if OS version ist 3.9 (or 3.5?). WINDOW.ICONS.SELECTED if you want to get selected icons.
I don`t know Toolsdaemon but maybe it has already a function that can parse selected files? Similar to DOpus its {f} for example. Would be the better solution. |
14 February 2016, 16:11 | #3 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
3.9 or earlier? In 3.9 you can do this without ToolsDaemon.
|
14 February 2016, 16:46 | #4 | |
Zone Friend
Join Date: Sep 2001
Location: Germany
Posts: 812
|
With 3.9, you don't need Toolsdaemon anymore, you can add a menu item to the tools menu using simple ARexx scripts:
Code:
/* This script will add a menu item to the Workbench's "Tools" menu */ ADDRESS workbench MENU ADD NAME '"<SOME_INTERNAL_REFERRER>"' TITLE '"<TITLE_THAT_APPEARS_IN_MENU>"' CMD "<COMMAND_TO_EXECUTE>" Quote:
Code:
/* not tested at all */ options results address "WORKBENCH" getattr windows.active ActiveWin = result getattr window.icons.selected name ActiveWin stem ActiveWinIcons SourceFile = ActiveWin if right(SourceFile,1) ~= ":" then SourceFile = SourceFile || "/" SourceFile = SourceFile || ActiveWinIcons.0.name address command 'C:ed "'SourceFile'"' |
|
14 February 2016, 19:19 | #5 |
BoingBagged
Join Date: Aug 2007
Location: The South of nowhere
Age: 46
Posts: 2,358
|
@Korodny
Thank you very much, the script works beautifully! It does not check for errors, but certainly works @daxb I now have an easy working example from which I can start learning ARexx little by little. Thanks @idrougge On 3.9 I use T.H.E. instead of ToolsDaemon |
15 February 2016, 01:52 | #6 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,630
|
BB4 actually has something similar already ("Tools|Edit text file..." command), the main difference being that it asks for a filename (via ASL). Maybe I should change this so that it automatically operates on the selected file.
|
15 February 2016, 04:31 | #7 |
BoingBagged
Join Date: Aug 2007
Location: The South of nowhere
Age: 46
Posts: 2,358
|
Yes, I just checked. To tell you the truth it is better this way (and it works just as it is), but I would only add to it, the missing error handling.
|
15 February 2016, 09:22 | #8 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,630
|
Here's a new version of the above script that will just open with a blank file if nothing is selected.
Code:
/* "Tools|Edit Text File..." command */ OPTIONS RESULTS ADDRESS "WORKBENCH" GETATTR WINDOWS.ACTIVE SourceFile = RESULT IF SourceFile = "" THEN DO ADDRESS COMMAND 'SYS:Tools/EditPad' EXIT END GETATTR WINDOW.ICONS.SELECTED.COUNT NAME SourceFile IF RESULT = 0 THEN DO ADDRESS COMMAND 'SYS:Tools/EditPad' EXIT END GETATTR WINDOW.ICONS.SELECTED NAME SourceFile STEM ActiveWinIcons IF RIGHT(SourceFile,1) ~= ":" THEN SourceFile = SourceFile || "/" SourceFile = SourceFile || ActiveWinIcons.0.NAME ADDRESS COMMAND 'SYS:Tools/EditPad "'SourceFile'"' Last edited by Minuous; 17 February 2016 at 05:47. |
12 May 2023, 11:40 | #9 | |
Registered User
Join Date: Dec 2010
Location: Norway
Posts: 817
|
Quote:
Just found this script of yours and started using it with MenuTools for textedit and multiview on my new 3.2.2.1 install. It works great! The only tiny issue is with multiview. If multiview is started without any flile selected and multiview is then closed without selecting a file, the script throws the DOS message that multiview failed with returncode 20. I added Options failat 21, and the arexx part of the error message went away (showing line numbers etc) but there is still a popup window with the dos error message which does not appear if I do the same manually from shell. (Open multiview then quit without choosing a file) Any ideas how to ignore the returncode from multiview entirely? Anyway - a very useful script. Thanks! |
|
13 May 2023, 21:57 | #10 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
Glad this post surfaced because I was not aware of the menu function and it's great!
However, I cannot get an AmigaDOS executable to be started by a menu entry. I tried some combination of these: PHP Code:
Thanks! |
14 May 2023, 03:20 | #11 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,630
|
It works here if I use:
Code:
ADDRESS COMMAND 'work:utils/ced' |
15 May 2023, 18:19 | #12 |
OctaMED Music Composer
Join Date: Jan 2009
Location: Venice - Italy
Age: 49
Posts: 666
|
Thanks, you mean like this?
PHP Code:
PHP Code:
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AREXX Help | Zetr0 | support.Other | 2 | 26 January 2011 23:09 |
arexx help | jimbobrocks92 | Coders. General | 4 | 19 January 2011 12:50 |
Arexx | redblade | request.Apps | 2 | 30 August 2006 11:51 |
[Amiga Action 63 disk 1] Valhalla: And The Lord Of Action | amigarulez | request.Old Rare Games | 13 | 25 June 2006 14:36 |
Arexx | Seti | Coders. General | 2 | 05 August 2003 18:59 |
|
|