home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 199 / 4CASE16.ZIP / 4CASE.ALS
Encoding:
Text File  |  1992-07-13  |  1.7 KB  |  48 lines

  1. :        4CASE15.ALS by Kenneth Albanowski [70705,126]
  2. :
  3. :                          V 1.6
  4. :
  5. :     Version 1         - Mid 1991
  6. :     Version 1.5       - January 1992
  7. :       I implemented some suggestions from Marshall Giguere
  8. :     Version 1.6       - July 1992
  9. :       Corrected bug
  10. :
  11. :   This is a set of aliases for 4DOS Version 4.0 only.
  12. :
  13. :   Load it with ALIAS /R 4CASE.ALS
  14. :
  15. :   Have you been looking for a way to make your batch files clearer?
  16. :   Miss the SWITCH (or SELECT) statement from your favorite programming
  17. :   language? This alias file contains a set of aliases to allow you to use
  18. :   PASCAL style SWITCH statements in your 4DOS batch files. Like IFF
  19. :   commands, they are fully nestable.
  20. :
  21. :   They are used as follows:
  22. :
  23. :     SWITCH "%VAR"   ^REM  To use text, you should surround it in quotes
  24. :        CASE "ABC"
  25. :           ECHO This will be echoed if %VAR is equal to ABC
  26. :        CASEIF NE "DEF"
  27. :           ECHO This will be echoed if %VAR is not equal to DEF
  28. :        CASETEST 1 gt 3
  29. :           ECHO This will never be echoed.
  30. :           ECHO Note that CASETEST does not use the original SWITCH parameter
  31. :        CASEELSE ^rem Or ELSECASE!
  32. :           ECHO This will only be echoed if none of the other tests
  33. :           ECHO succeeded.
  34. :     ENDSWITCH ^REM Or ENDCASE!
  35. :
  36. : If you need to contact me, E-MAIL me a message at [70705,126]
  37. :
  38.  
  39. SWITCH*F=set case_l=%@eval[0%case_l+1]^set case_v%[case_l]=%1^IFF 1==2 then
  40. CASE=ELSEIFF %[case_v%[case_l]] == %1 then
  41. CASEIF=elseiff %[case_v%[case_l]] %& then
  42. CASETEST=elseiff %& then
  43. CASEELSE=else
  44. :CASEDEFAULT=else
  45. :DEFAULT=else
  46. ENDSWITCH*F=endiff^set case_l=%@eval[%case_l-1]^if %case_l le 0 unset case_l
  47.  
  48.