home *** CD-ROM | disk | FTP | other *** search
- /* Commander for Directory Opus 5.5
- by Leo 'Nudel' Davidson for Gods'Gift Utilities
- email: leo.davidson@keble.oxford.ac.uk www: http://users.ox.ac.uk/~kebl0364
-
- $VER: Commander.dopus5 1.1 (13.6.96)
-
- This script will open a window and will send the given string to the DOpus5
- ARexx port. It's like the "Execute command..." menu item but for ARexx
- commands.
-
- It will remember the previous command you used and you can set a default
- command to be given the first time the script is used after a reboot
- (it'd be easy to make it remember after reset if anyone wanted it).
-
- Will return the result of the command if there is one.
-
- TO DO: Substitue for $SOURCE and $DEST on the command. Perhaps when/if I
- convert it to Assembler for DOpusFuncs.
- - Doesn't like single-quotes (') in the command string. Pain to fix.
- - Doesn't like double ones much either which is a little restricting...
- > Well, as it is this is a little half-baked. Sorry, I have no plans
- to fix all of this because I've got something better now.
-
- Call as:
- ------------------------------------------------------------------------------
- ARexx DOpus5:ARexx/Commander.dopus5 {Qp} [<default command>]
- ------------------------------------------------------------------------------
- Turn off all switches.
-
- */
- options results
- options failat 99
- signal on syntax;signal on ioerr /* Error trapping */
- parse arg DOpusPort def_cmd
- DOpusPort = Strip(DOpusPort,"B",'" ')
- def_cmd = Strip(def_cmd,"B",'" ')
-
- If DOpusPort="" THEN Do
- Say "Not correctly called from Directory Opus 5!"
- Say "Load this ARexx script into an editor for more info."
- EXIT
- END
- If ~Show("P",DOpusPort) Then Do
- Say DOpusPort "is not a valid port."
- EXIT
- End
- Address value DOpusPort
-
- dopus version
- If ( result='RESULT' | translate(result,'.',' ') < 5.1218 ) then do
- dopus request '"This script requires DOpus v5.5 or greater." OK'
- EXIT
- end
-
- EnvName = "Env:Commander_DOpus5"
-
- If Exists(EnvName) Then Do
- If Open(EnvDef,EnvName,"R") Then Do
- def_cmd = ReadLn(EnvDef)
- Close(EnvDef)
- End
- End
-
- dopus getstring "'Enter DOpus5 ARexx command' 256 '" || def_cmd || "' Okay|Cancel"
- If DOPUSRC = 0 Then
- Exit
-
- new_cmd = RESULT
-
- If new_cmd = "" Then
- Exit
-
- If Open(EnvDef,EnvName,"W") Then Do
- WriteLn(EnvDef,new_cmd)
- Close(EnvDef)
- End
-
- new_cmd
-
- IF RC ~=0 Then Do
- dopus error RC
- dopus request "'Error:" RESULT || "' Okay"
- End
- Else Do
- If RESULT ~="RESULT" Then
- dopus request "'Result of command:" || X2C(0A) || RESULT || "' Okay"
- End
- End
-
- syntax:;ioerr: /* In case of error, jump here */
- EXIT
-