home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / Converter / AD2.55-C.DMS / in.adf / FREDScripts.lha / FREDFunctions / GetAFile < prev    next >
Encoding:
Text File  |  1994-01-31  |  1.3 KB  |  72 lines

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