home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 2
/
amigaformatcd02.iso
/
pd
/
text
/
alphaspell_suite
/
varexx
/
demo
/
testgui.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-05-20
|
2KB
|
95 lines
/*************************************************************************/
/* $VER: testgui.rexx 1.1 (6.12.95) */
/* Script to test varexx GUI's */
/* Usage: rx testgui GUINAME */
/* Displays the given .GUI file and echos all messages to STDOUT */
/* Useful for testing .GUI files before the rest of the script is */
/* written. */
/*************************************************************************/
gui_file = arg(1)
IF EXISTS("libs:rexxsupport.library") THEN DO
IF ~SHOW("L","rexxsupport.library") THEN
IF ~ADDLIB("rexxsupport.library",0,-30,0) THEN EXIT
END
ELSE EXIT
IF EXISTS("libs:rexxreqtools.library") THEN DO
IF ~SHOW("L","rexxreqtools.library") THEN
IF ~ADDLIB("rexxreqtools.library",0,-30) THEN EXIT
END
ELSE EXIT
OPTIONS RESULTS
OPTIONS FAILAT 10
SIGNAL ON SYNTAX
SIGNAL ON FAILURE
/* Get the GUI file from the user */
IF gui_file = '' THEN
DO
gui_file=rtfilerequest('REXX:gui',,'Varexx Request','_Load','rt_reqpos=reqpos_centerscr rtfi_matchpat=#?.gui rtfi_flags=freqf_patgad')
IF gui_file = '' THEN EXIT
END
/* Check Varexx is loaded if not load it */
IF SHOW( 'p', 'VAREXX' ) ~= 1 THEN DO
ADDRESS COMMAND "run >NIL: varexx"
ADDRESS COMMAND "WaitForPort VAREXX"
END
ADDRESS VAREXX
IF OPENPORT("HOLLY") = 0 THEN DO
CALL rtezrequest "Could not open a port.",, "Varexx Error"
EXIT
END
'load ' gui_file 'HOLLY'
vhost = RESULT
say rc externerror
ADDRESS VALUE vhost
show
/**************************************************************************/
/* MAIN LOOP -- Check for GUI events */
/**************************************************************************/
DO FOREVER
CALL WAITPKT("HOLLY")
packet = GETPKT("HOLLY")
IF packet ~= '00000000'x THEN DO
class = GETARG(packet)
say class
if class = "CLOSEWINDOW" THEN LEAVE
END
END
'hide unload'
CALL CLOSEPORT( "HOLLY" )
EXIT
/* Error messages */
failure:
SAY "Error code" rc "-- Line" SIGL
SAY EXTERNERROR
'hide unload'
CALL CLOSEPORT ("HOLLY")
EXIT
syntax:
SAY "Error" rc "-- Line" SIGL
SAY ERRORTEXT( rc )
'hide unload'
CALL CLOSEPORT ("HOLLY")
EXIT