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

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