Guidance
指路人
g.yi.org
Software / Reginald / Examples / RunChild.rex

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* An example of using RXRUNSCRIPT() to safely call a child RXDLG script
 * so that it doesn't close our own windows, or mess up our RXERR() settings.
 */

/* Toss away the return from a function if
 * we don't assign it to a variable
 */
ADDRESS null

/* Trap SYNTAX/ERROR/HAT, and ask for ERROR raising */
SIGNAL ON HALT
SIGNAL ON SYNTAX
SIGNAL ON ERROR
CALL RXERR('ERROR|DISPLAY')





/* ====================== 'Main Window' ======================= */
/* Make an ENTRY to type in the name of the script to run */
rxtype.1 = 'ENTRY'
rxflags.1 = 'REPORT'
rxlabel.1 = 'Script to run:|'
rxpos.1 = '-1 5 5 150'
rxval.1 = 'TEXT'

text.1 = ''

rx = ''

CALL RXCREATE('RX', 1, 'Main Window', 'NOCLOSE')

DO FOREVER
   CALL RXMSG()
   IF rxid == '' THEN SIGNAL HALT

   /* If he selected the ENTRY, then run the child script, passing it no args */
   IF rxid == 1 & rxsubid == 1 THEN DO

      /* Run the script */
      err = RXRUNSCRIPT(text.1)

      /* Did it execute Ok? If not, an error message has already been displayed */
      IF err == "" THEN DO

         /* See if it returned a value. If so, display it. */
         IF SYMBOL('RC') == 'VAR' THEN CALL RXSAY(rc, , 'REXX return')
         ELSE CALL RXSAY("", , 'No REXX return')

      END

   END

END




/* ==================== Error Handling ====================== */
syntax:
    CALL RXSAY(CONDITION('D') || '0D0A0D0A'x || SOURCELINE(sigl),,'Error '||condition('E')||' at line '||sigl)

halt:
error:
    /* NOTE: CONDITION('D') fetches error message. CONDITION('E') fetches the
     * error number. SIGL is the line number where the error occurred.
     * Rexx Dialog has already displayed a message since we specified DISPLAY
     * option.
     */
    CALL RXMSG(,'END')
    EXIT
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2017-6-23  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:35:17