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

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* An example of using RXFILE() to pick out a directory. We use the
 * Directory Browser instead of the File Dialog.
 */

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

/* Trap HALT and SYNTAX in any scripts we call which don't
 * trap HALT or SYNTAX themselves.
 */
OPTIONS 'TRAP'

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






/* Store the directory name in the variable FN. Initialize it to 'C:\WINDOWS' so
 * that one is initially selected. But, we could instead not assign any
 * value, or assign an empty string, to not provide an initial selection.
 */
fn = 'C:\WINDOWS'


/* Do the Browse Dialog, with a box to enter a "New folder" name. Browse the
 * DRIVES on the system.
 */
err = RXFILE('FN', 'BROWSE|DRIVES|NEW', 'Pick out a directory')

/* Check for OK */
IF err == "" THEN DO

   /* Display the chosen directory */
   CALL RXSAY(fn)

END

/* RC must be 'Cancel', because all other errors jumped to SYNTAX */
ELSE CALL RXSAY('User cancelled!')

/* Done. Note that we don't need to do an RXMSG(,'END') because we have
 * no windows open with the 'NOCLOSE' flag
 */
EXIT






/* ==================== 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
掌柜推荐
 
 
¥420.00 ·
 
 
¥470.00 ·
 
 
¥890.00 ·
 
 
¥660.00 ·
 
 
¥748.00 ·
 
 
¥1,800.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-18 23:34:50