#AREXX fun.
4 messages in this thread
One of the reasons I like AREXX is that you can modify your working
environment so easily and modify specific programs so that they work more to
your liking. I have been using the reader 'rd' that comes with Access! (the
reader is enough to justify a download of Access!.arc) and I (obviously) like
it. I just thought that it would be neat if it would ask for a file to read if
I didn't specify one on the command line i.e. 'rd filename' would just bring
up the reader showing filename but 'rd' would bring up the ARP file requester.
Here is an AREXX program to do that:
/* This is a 'reader' program done in AREXX by W. Hawes */
/* J. Scott Thayer, M.D. 9/23/88 */
check = addlib('rexxsupport.library',0,-30,0)
check = addlib('rexxarplib.library',0,-30,0)
arg x
if x = "" then do
dir = ""
filename = ""
x = getfile(315,70,dir,filename,"CLICK/DIRECTORY & FILE",)
if x = "" then exit
end
if ~exists(x) then do
say "Hmmm… "||x||" isn't around."
exit
end
rd x /* Put YOUR favorite 'reader' program here. */ exit
As another variation on a theme here is a program to allow you to 'run' a
program from a file requester:
/* This is a 'run whatever' routine */
/* Done in 30 minutes using AREXX with much laughter! */
/* By J. Scott Thayer M.D. 9/22/88 */
check = addlib('rexxsupport.library',0,-30,0)
check = addlib('rexxarplib.library',0,-30,0)
arg x
if x = "" then do
dir = ""
filename = ""
x = getfile(315,70,dir,filename,"CLICK/DIRECTORY & FILE",)
if x = "" then exit
end
run x exit
Fun stuff, thanks Bill!
Scott
Neat stuff! (and thanks for the plug… 'rd' is a bit improved for 1.41, it has
an 'Iconify' feature, and is a bit smaller at the same time 8).
– Keith
J. Scott Thayer
Question, don't you need the line (address command) in both programs? I tried
both programs you wrote but came up with and error on the last line of each.
(rd x exit) and (run x exit) both returned (+++Command return 5) to the screen.
When I added in address command they worked fine. I am new to ARexxand could be
missing something? (I hope not my mind)
Scott Thayer's example is meant to be run from WSHell, which becomes the
default host for commands. In general, you shouldn't ever need the ADDRESS
COMMAND … instruction if the ARexx program is run from WShell; it is intended
for situations where you don't have a shell host but still need to run a DOS
command.
If you ever need to find out what your default host address is, put in a
say address()
statement and check in out. WShell host addresses are named WSH_nn, where nn
is the task number.