Welcome, Guest. Please login or register.

Author Topic: Help needed with Requestfile & Dos script  (Read 1194 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline vanderrollTopic starter

  • Newbie
  • *
  • Join Date: Feb 2011
  • Posts: 8
    • Show only replies by vanderroll
Help needed with Requestfile & Dos script
« on: March 10, 2013, 04:11:14 PM »
Hi

Long story short - i lost most s/w including registered SID2 (Tim Martin) and all i have left is a bunch of scripts created by my old friend "PJ" in the early 1990's, ive long since lost contact with him. While i was creating music and graphics he was busy learning DOS/ARexx and would often supply a disk with a script and a few files for SID, i would add them to a SID button and Hey Presto - stuff would happen!

Without SID these scripts are fairly useless so i want to start modifying them for use with the Dos command "Requestfile".

Below is a simple(ish) script he wrote to open a requester and give more options to the "READ" button in SID. Through the art of Black Magic or other dark force SID would pass the selected file into the script as "" and launch the "" with the selected program from the requester.

What i want to do is replace SID with Requestfile but i have no idea where to start, how can i get the selected file from Requestfile into this script?

.key file
;$VER: SID_READ GUI
failat 9999

;- Setup Programs & Paths
Set Read="Run SYS:tools/cli/PPMORE"
Set PlusEd="Run SYS:tools/PlusED"
Set GoCed="Rx SS:Ced.rexx"
Set IDEdit="EDIZ_TXT"
;-End Setup

Lab start
Set req=`Requestchoice "SID_READ GUI"  "Select program to read*N" "ASCII" "FILEID" "ANSI" "EDIT" "ADD2PLUG" "EXIT"`

if $req eq "0"
 Skip Exit
endif

if $req eq "1"
 $Read ""
endif

if $req eq "2"
 $IDEDIT ""
endif

if $req eq "3"
 $PlusEd ""

if $req eq "4"
 $GoCed ""
endif

if $req eq "5"
 Search SS:EDIZ_LHA_Plugs ""
 if warn
  Echo >>SS:EDIZ_LHA_Plugs ""
 endif
endif

;skip back start
Lab


Thanks
 

Offline Thomas

Re: Help needed with Requestfile & Dos script
« Reply #1 on: March 10, 2013, 04:33:25 PM »
Replace all occurrences of by $file, then add the following lines just after failat 9999:

Code: [Select]

set file=`requestfile`
if $file eq ""
  skip Exit
endif


Btw, the last line should read Lab Exit, not just Lab.

And the first line .key file can be removed.

Or, if you optionally want to be able to call the script with a file name as parameter, keep the first line and change my lines to

Code: [Select]

set file=""
if $file eq ""
  set file=`requestfile`
  if $file eq ""
    skip Exit
  endif
endif

Offline vanderrollTopic starter

  • Newbie
  • *
  • Join Date: Feb 2011
  • Posts: 8
    • Show only replies by vanderroll
Re: Help needed with Requestfile & Dos script
« Reply #2 on: March 10, 2013, 04:56:41 PM »
Thanks Thomas - is that a sort of universal way to launch Requestfile in a script and use the result?
 

Offline Thomas

Re: Help needed with Requestfile & Dos script
« Reply #3 on: March 10, 2013, 06:27:46 PM »
RequestFile prints its result to the console. The same does RequestChoice. If you compare the usage of RequestFile and RequestChoice in your script, you see that surrounding a command by grave accents lets you use the output of that command in another command. If this case the output of RequestFile resp. RequestChoice is inserted into the Set command.