-
-
Order of the Butterfly
Posts: 221 from 2003/2/24
From: Austria, Vienna
Hi osco,
Sorry for the missing " which gave you the error in the first place, but you found out yourself as I can see.
Not sure, whether I made myself clear with the "if you execute it,..." line.
What I ment was, that after the execution of the list command, you get a batch file, that might look like
foo.rexx "ram:file001.ps"
foo.rexx "ram:file002.ps"
foo.rexx "ram:file003.ps"
if you have the files file001.ps, file002.ps and file003.ps in your RAM: disk when executing it.
Now you can just enter "execute bar.bat" and the shell will execute each line as if you have typed it into the shell directly.
In the AREXX script itself, you have to use "parse arg ..." to get the name of the file - albeit with the surrounding ".
Your AREXX script would look like the following
--- cut here ---
/* $VER: foo.rexx 1.0 (27.04.2010) */
OPTIONS RESULTS
/* places argument into sourcename variable */
PARSE ARG sourcename
/* removes surrounding " */
sourcename = strip(sourcename, 'B', '"')
/* removes "ps" extension and adds "txt" extension instead */
targetname = left(sourcename, length(sourcename) - 2)||"txt"
/* main program */
if open(input,sourcename, R) then do
if ~open(output,targetname, W) then call error
Do until eof(input)
line=readln( input)
if pos('(',line) =1 then writeln(output, line) /* line begins with '(' at POS 1 */
end
close(input)
close(output)
end
EXIT
ERROR:
SAY "ERROR"
EXIT
--- cut here ---
Hope I made myself clear and didn't include some more typos in the upper listing.
Bye HAK
-
»26.04.10 - 23:52