home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
357.lha
/
FMutils
/
RExxRun.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1990-03-13
|
4KB
|
109 lines
/*---------------------------- Start REXX Source ----------------------------*/
/* * Adapted from Dan Schenck's print spooler. Thanks, Dan! */
/* Modified by Steven D. Kapplin on 27-NOV-89 */
/* RUN any program or script (if script (s) bit set) with arguments */
/* by inserting a space after filename and entering any arguments */
/* before clicking on OK. Start program with '?' for help; if a */
/* path follows, then RExxRun logs into that path or defaults to VD0: */
/* Command syntax: RExxRun [? | path | device]. If no arg is */
/* supplied then RExxRun logs into VD0:. Change this if you prefer */
/* to default to a different device or path. */
/* Can be used as a utility with FastMenu1.rexx. */
if ~show(L,'rexxsupport.library') then
rc = addlib('rexxsupport.library',0,-30,0)
if ~show(L,'rexxarplib.library') then
rc = addlib('rexxarplib.library',0,-30,0)
signal on BREAK_C
true = 1
false = 0
name = "df0:||||"
parse arg cdir .
if cdir = "?" then call banner
/* Change VD0: to the path or device of your choice */
if cdir = "" then cdir = "VD0:"
do forever
do while(name = "df0:||||")
arg_flag = false
name = getfile(340,11,cdir,,'RExxRun - Select Program')
if name = "" then call end_all()
nw = words(name)
parms = subword(name,2,nw-1)
name = word(name,1)
call parse_dir
end
address command
if index(cdir,":") = 0 then file2show = pragma('D') || cdir || "/" || name
else if right(cdir,1) ~= ":" then file2show = cdir || "/" || name
else file2show = cdir || name
ADDRESS COMMAND 'run' file2show || " " || parms
name = "df0:||||"
end
/* parse_dir Procedure */
/* */
/* Separate the directory portion of the file name if there is any from */
/* the file name itself. "cdir" will contain the new directory or be left */
/* untouched if there is no directory. "name" will be modified to only */
/* contain the file name itself or "df0:||||" if there is no file name. */
parse_dir: procedure expose cdir name
if length(name) = 0 then
do /* No name or directory */
name = "df0:||||"
return
end
if ~exists(name) then
do /* Bad directory/file name */
name = "df0:||||"
return
end
i_colon = lastpos(":",name)
i_slash = lastpos("/",name)
if left(statef(name),1) = "F" then
do /* This a file, not just a directory */
if i_slash > 0 then
do /* At least one subdirectory has been given */
cdir = substr(name,1,i_slash-1)
name = substr(name,i_slash+1)
return
end
if i_colon > 0 then
do /* A main directory has been given */
cdir = substr(name,1,i_colon)
name = substr(name,i_colon+1)
return
end
return
end
if i_slash > 0 then
do /* A subdirectory with no file has been given */
cdir = name
name = "df0:||||"
return
end
/* A main directory or subdirectory only has been given */
if i_colon = 0 then cdir = cdir || name
else cdir = name
name = "df0:||||"
return
BREAK_C:
call end_all()
end_all: procedure
exit
banner:
Say "Command Syntax: RExxRun [?] | [<path>]"
Say " ? displays this message"
Say " <path> sets login path - default path ==> VD0:"
exit 5
/*----------------------------- End REXX Source -----------------------------*/