home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / ADPro251-3.DMS / ADPro251-3.adf / FREDScripts.lha / FREDFunctions / GetADir < prev    next >
Encoding:
Text File  |  1994-01-31  |  1.2 KB  |  70 lines

  1. /*
  2. ** GetADir
  3. **
  4. ** $VER: GetADir 1.1.0 (5.11.93)
  5. **
  6. ** This ARexx script contains a function which asks the user to enter
  7. ** a directory.
  8. **
  9. ** INPUTS
  10. **    Title -- text shown to the user asking for a string.
  11. **    DefaultDir -- default directory.
  12. **    IsRequired -- TRUE, if the directory is required; FALSE, otherwise.
  13. **
  14. ** RETURN
  15. **    EnteredDir -- the entered directory, or "" if aborted.
  16. **
  17. ** This script should work with current versions of ARexx.
  18. **
  19. ** Copyright © 1993 ASDG, Incorporated
  20. ** All Rights Reserved
  21. */
  22.  
  23.  
  24. ADDRESS "ADPro"
  25. OPTIONS RESULTS
  26.  
  27. NL = '0A'X
  28. SQ = '27'X
  29. DQ = '22'X
  30. TRUE  = 1
  31. FALSE = 0
  32.  
  33. PARSE ARG Arguments
  34. PARSE VAR Arguments '"'Title'"' '"'DefaultDir'"' IsRequired
  35.  
  36. Title = DQ || Title || DQ
  37. DefaultDir = DQ || DefaultDir || DQ
  38.  
  39. continue = TRUE
  40. DO WHILE (continue = TRUE)
  41.     ADPRO_TO_FRONT
  42.  
  43.     GETDIR Title DefaultDir
  44.     EnteredDir = ADPRO_RESULT
  45.  
  46.     IF (RC ~= 0) THEN DO
  47.         IF (IsRequired = TRUE) THEN DO
  48.             ADPRO_TO_FRONT
  49.  
  50.             OKAYN '"GetADir"' '"This value is required."' '"Retry|Cancel"'
  51.             IF (RC = 0) THEN DO
  52.                 EnteredDir = DQ || DQ
  53.                 continue = FALSE
  54.             END
  55.         END
  56.         ELSE DO
  57.             EnteredDir = DQ || DQ
  58.             continue = FALSE
  59.         END
  60.     END
  61.     ELSE
  62.         continue = FALSE
  63. END
  64.  
  65. SCREEN_TO_FRONT "FRED"
  66.  
  67. RETURN EnteredDir
  68.  
  69. EXIT 0
  70.