home *** CD-ROM | disk | FTP | other *** search
- /* ReadMe - Introduction to, and example of, RexxMenu.cmd. This file
- * is meant to be executed, not necessarily read. So from the
- * command line or the desktop run README.CMD.
- *
- * ReadMe uses RexxMenu.dll, and RexxMenu.dll must be available in the
- * current directory.
- */
- '@echo off'
- /*'mode 80,25'*/
-
- 'cls'
- say
- say ' ReadMe.cmd uses RexxMenu, EnviMenu, and MenuPick as an example of'
- say ' how to use these menu utilities. The menu screens that follow are'
- say ' controlled by Rexx- or Envi-menu.'
- say
- say ' There are two hidden options in this ReadMe.cmd menu. Type "HID"'
- say ' or "SECRET" to find these options.'
- say
- 'pause'
-
- /* For this readme demo, expect RexxMenu.dll to be in the current directory,
- * and so build the file name of the current directory.
- */
- RexxMenuDLLSpec = DIRECTORY()
- if \(LENGTH(RexxMenuDLLSpec) = 3) then RexxMenuDLLSpec = INSERT(RexxMenuDLLSpec,'\')
- RexxMenuDLLSpec = INSERT(RexxMenuDLLSpec,'RexxMenu.dll')
- CALL RxFuncAdd 'SysFileTree', 'rexxutil', 'SysFileTree'
- CALL SysFileTree RexxMenuDLLSpec, 'FileList' , 'OF'
- if FileList.0 = 0 then do
- DROP FileList.
- say ''
- say ' Readme.cmd needs "RexxMenu.dll" in the current directory.'
- say
- 'pause'
- EXIT
- end /* Do */
- DROP FileList.
-
- /* Try oh try to register the RexxMenu Function */
- CALL RxFuncDrop 'RexxMenu'
- CALL RxFuncAdd 'RexxMenu', RexxMenuDLLSpec, 'RexxMenu'
-
- /* Until the user quits, allow them to pick readme choices */
- RememberCurDir = DIRECTORY()
- MenuChoice = ''
- DO FOREVER
- CALL Directory RememberCurDir
- MenuChoice = RexxMenu('ReadMe.cmd','/Suf','.:','/Com','/* ',,
- '/Init',MenuChoice,'/Hid','_SECRET_',,
- '/Prompt','Select a RexxMenu topic:')
- if 0 = COMPARE(MenuChoice,'') then signal Quit.
- interpret 'CALL' INSERT(MenuChoice,'.');
- end /* do */
- EXIT
-
-
- /**********************************************************************/
- /* WHAT FOLLOWS IS A LIST OF FUNCTIONS THAT README.CMD CAN ACCESS */
- /**********************************************************************/
-
- View.RexxMenu.User.Document.:
- /* Read the document for how to use RexxMenn in your REXX language programs
- */
- 'attrib RexxMenu.doc +r'
- 'e.exe RexxMenu.doc'
- RETURN
-
- RexxMenuHelp.:
- /* View help information (RexxMenuHelp) from the RexxMenu dll
- */
- CALL RxFuncDrop 'RexxMenuHelp'
- CALL RxFuncAdd 'RexxMenuHelp', RexxMenuDLLSpec, 'RexxMenuHelp'
- 'mode 80,50'
- call RexxMenuHelp
- 'mode 80,25'
- CALL RxFuncDrop 'RexxMenuHelp'
- RETURN
-
- EnviMenu.:
- /* Descripton of EnviMenu: RexxMenu wrapper for the REXXaphobic
- */
- 'cls'
- say
- say 'EnviMenu - A shell for calling RexxMenu from the command line or from a .cmd'
- say ' batch file. EnviMenu sets an environment variable from a menu.'
- say
- say 'SYNTAX: EnviMenu <ENVIRONMENT_VARIABLE> <FileSpec> [RexxMenu Options...]'
- say 'Where:'
- say ' ENVIRONMENT_VARIABLE - This environment variable will be set to the chosen'
- say ' menu option. Same as the <Choice> option in RexxMenu().'
- say ' FileSpec - Same as the <File> argument in RexxMenu().'
- say ' RexxMenu Options - Options can be added the same as they are in RexxMenu(),'
- say ' but there should not be commas between options, but spaces.'
- say
- say 'Example: To set environment variable CHOICE from the options "Yes",'
- say ' "No", and "Not Sure yet" listed in the file OPTIONS, enter the'
- say ' following at the command line or call from a batch file:'
- say ' EnviMenu CHOICE options /Prompt "Are you ready to rock?" /Init Yes'
- say
- 'pause'
- RETURN
-
- MenuPick.:
- /* Descripton of MenuPick: another RexxMenu wrapper for the REXXaphobic
- */
- 'cls'
- 'call MenuPick'
- 'pause'
- RETURN
-
- Examples.:
- /* Test and view sample .CMD files that demonstrate some uses of RexxMenu
- */
- ExampleChoice = ''
- do until ExampleChoice = ''
- CALL Directory RememberCurDir
- ExampleChoice = RexxMenu('ReadMe.cmd','/Suf','.Example:','/Com','/* ',,
- '/Init',ExampleChoice,'/Esc','/Sort',,
- '/Prompt','Select Example to Run or View (Esc to quit)')
- if \(ExampleChoice = '') then
- interpret 'CALL' INSERT(ExampleChoice,'.Example');
- end /* do */
- RETURN
-
-
- Install.:
- /* Copy RexxMenu.dll to a directory from your LIBPATH variable in C:\CONFIG.SYS
- */
- /* Make sure that C:\CONFIG.SYS exists */
- 'cls'
- InstallFail = 1 /* assume it failed to install */
- CALL SysFileTree 'C:\CONFIG.SYS', 'FileList' , 'OF'
- if 0 = FileList.0 then do
- say ' Could not find C:\CONFIG.SYS to get value of LIBPATH.'
- end /* Do */
- else do
- /* Read the LIBPATH line from CONFIG.SYS */
- LibPath = RexxMenu('C:\CONFIG.SYS','/Time','0','/Prompt','NONE',,
- '/Pre','LIBPATH')
- 'cls'
- /* Skip all spaces and '=' at the beginning of LibPath */
- do while \(LibPath = '') & (LEFT(LibPath,1) = '' | LEFT(LibPath,1) = '=')
- LibPath = RIGHT(LibPath,LENGTH(LibPath)-1)
- end /* do */
- if LibPath = '' then do
- say ' Could not get a value for LIBPATH from C:\CONFIG.SYS.'
- end /* Do */
- else do
- /* Create File with one entry for each element of LibPath, but only those
- * elements which are, or nearly are, absolute directories
- */
- 'if exist PathMenu.tmp del PathMenu.tmp'
- OptionCount = 0
- do until Dir = ''
- PARSE VAR LibPath Dir ';' LibPath
- if Dir = '' then Dir = LibPath
- if \(Dir = '') then do
- if LEFT(Dir,1) = '\' | (2 < LENGTH(Dir) & SUBSTR(Dir,2,2) = ':\') then do
- 'echo' Dir '>> PathMenu.tmp'
- OptionCount = OptionCount + 1
- end /* Do */
- end /* Do */
- end /* do */
- if OptionCount = 0 then do
- say ' Found no absolute directories to install to in LIBPATH of C:\CONFIG.SYS'
- end /* Do */
- else do
- Dir = RexxMenu('PathMenu.tmp','/Esc','/Sort',,
- '/Prompt','Select Directory to install RexxMenu.dll to (Esc to quit)')
- 'if exist PathMenu.tmp del PathMenu.tmp'
- 'cls'
- if Dir = '' then do
- say ' RexxMenu.dll was not installed in any directory'
- InstallFail = 0
- end /* Do */
- else do
- /* Put a backslash at the end of dir if it doesn't have one alread */
- if \('\' = RIGHT(DIR,1)) then DIR = INSERT(DIR,'\')
- 'if exist' INSERT(Dir,'RexxMenu.dll') 'attrib' INSERT(Dir,'RexxMenu.dll') '-r -s -h'
- 'copy RexxMenu.dll' INSERT(Dir,'RexxMenu.dll')
- /* Test that it seems to have been copied there */
- CALL SysFileTree INSERT(Dir,'RexxMenu.dll'),'FindFile','F'
- if FindFile.0 = 0 then do
- say ' Tried to copy RexxMenu.dll to' INSERT(Dir,'RexxMenu.dll')
- say ' but it does not seem to have worked.'
- end /* Do */
- else do
- say ' RexxMenu.dll has been installed in your chosen LIBPATH directory.'
- say ' It should now be available in REXX files anywhere.'
- InstallFail = 0
- end /* Do */
- end /* Do */
- end /* Do */
- end /* Do */
- end /* Do */
- if InstallFail = 1 then do
- say ''
- say ' Automatic installation was unsuccesful. Please copy RexxMenu.dll'
- say ' into one of the directories in your LIBPATH variable.'
- end /* Do */
- say
- 'pause'
- DROP FileList.
-
- /* DO NEARLY THE SAME INSTALLATION FOR UTILITY FILES INTO PATH PLACES */
- InstallFail = 1
- 'set MP_PROMPT=Install EnviMenu and MenuPick utilities?'
- 'call MenuPick MP_INSTALL Yes:Yes, install into a selected PATH directory.;No:No, do not install.'
- if value('MP_INSTALL',,'OS2ENVIRONMENT') = 'Yes' then do
- /* Use LIBPATH as the PATH environment variable */
- LibPath = value('PATH',,'OS2ENVIRONMENT')
- 'cls'
- /* Skip all spaces and '=' at the beginning of LibPath */
- do while \(LibPath = '') & (LEFT(LibPath,1) = '' | LEFT(LibPath,1) = '=')
- LibPath = RIGHT(LibPath,LENGTH(LibPath)-1)
- end /* do */
- if LibPath = '' then do
- say ' Could not get a value for the PATH environment variable.'
- end /* Do */
- else do
- /* Create File with one entry for each element of LibPath, but only those
- * elements which are, or nearly are, absolute directories
- */
- 'if exist PathMenu.tmp del PathMenu.tmp'
- OptionCount = 0
- do until Dir = ''
- PARSE VAR LibPath Dir ';' LibPath
- if Dir = '' then Dir = LibPath
- if \(Dir = '') then do
- if LEFT(Dir,1) = '\' | (2 < LENGTH(Dir) & SUBSTR(Dir,2,2) = ':\') then do
- 'echo' Dir '>> PathMenu.tmp'
- OptionCount = OptionCount + 1
- end /* Do */
- end /* Do */
- end /* do */
- if OptionCount = 0 then do
- say ' Found no absolute directories to install to in PATH environment variable.'
- end /* Do */
- else do
- Dir = RexxMenu('PathMenu.tmp','/Esc','/Sort',,
- '/Prompt','Select PATH Directory to install EnviMenu and MenuPick (Esc to quit)')
- 'if exist PathMenu.tmp del PathMenu.tmp'
- 'cls'
- if Dir = '' then do
- say ' Utilities were not installed in any directory'
- InstallFail = 0
- end /* Do */
- else do
- /* Put a backslash at the end of dir if it doesn't have one alread */
- if \('\' = RIGHT(DIR,1)) then DIR = INSERT(DIR,'\')
- 'if exist' INSERT(Dir,'EnviMenu.cmd') 'attrib' INSERT(Dir,'EnviMenu.cmd') '-r -s -h'
- 'if exist' INSERT(Dir,'MenuPick.cmd') 'attrib' INSERT(Dir,'MenuPick.cmd') '-r -s -h'
- 'copy EnviMenu.cmd' INSERT(Dir,'EnviMenu.cmd')
- 'copy MenuPick.cmd' INSERT(Dir,'MenuPick.cmd')
- /* Test that it seems to have been copied there */
- CALL SysFileTree INSERT(Dir,'EnviMenu.cmd'),'FindFile','F'
- if \(FindFile.0 = 0) then
- CALL SysFileTree INSERT(Dir,'MenuPick.cmd'),'FindFile','F'
- if FindFile.0 = 0 then do
- say ' Tried to copy EnviMenu.cmd and MenuPick.cmd to' Dir
- say ' but it does not seem to have worked.'
- end /* Do */
- else do
- say ' EnviMenu.cmd and MenuPick.cmd have been installed in your chosen'
- say ' PATH directory.'
- InstallFail = 0
- end /* Do */
- end /* Do */
- end /* Do */
- end /* Do */
- end /* Do */
- if InstallFail = 1 then do
- say ''
- say ' Automatic installation was unsuccesful. Please copy EnviMenu.cmd'
- say ' and MenuPick.cmd into one of the directories in your PATH.'
- end /* Do */
- say
- 'pause'
- RETURN
-
- Register.:
- /* RexxMenu is shareware. Select this option to PRINT a registration form.
- */
- 'cls'
- say
- say ' Attempting to print Register.FRM...'
- say
- say ' If this is unsuccesful then please print the file Register.FRM'
- say ' in whatever way you normally print text. Or, read the Register.FRM'
- say ' and send the information contained in that form along with your'
- say ' shareware-level payment ($5 for clean conscience, $10 for'
- say ' registration, updates, and support) to:'
- say
- say ' Brent Noorda'
- say ' 36 Tainter Street'
- say ' Medford, MA 02155'
- say ' USA'
- say
- say
- say 'print Register.FRM'
- say
- 'print Register.FRM'
- 'pause'
- RETURN
-
- Quit.:
- /* Quit ReadMe.cmd, and return to the OS/2 prompt
- */
- CALL RxFuncDrop 'RexxMenu'
- 'cls'
- say
- say ' If you enjoy using this shareware product, then please do not forget'
- say ' to register. See the "Register" option from the ReadMe.cmd menu, or'
- say ' print and fill out the "Register.FRM" file.'
- say
- /* ADD RexxMenu function support from the RexxMenu.dll */
- CALL RxFuncAdd 'SysSleep', 'rexxutil', 'SysSleep'
- CALL SysSleep 5
- say
- say
- '@pause'
- EXIT
-
- _SECRET_Hid.:
- 'cls'
- say
- say ' Congratulations. You found a hidden menu option and all you got was this'
- say ' lousy message.'
- say
- 'pause'
- RETURN
-
- _SECRET_Secret.:
- 'cls'
- say
- say
- say ' When law has been outlawed, only outlaws will be lawyers.'
- say
- say
- 'pause'
- RETURN
-
-
- /**********************************************************************/
- /* WHAT FOLLOWS IS A LIST OF FUNCTIONS THAT ARE ACCESSED FROM THE */
- /* EXAMPLES PORTION OF README.CMD */
- /**********************************************************************/
-
- ViewInfo....Run.Example:
- /* Demonstration program to choose from known list of *.INF file to view
- */
- CALL ViewInfo.cmd
- RETURN
-
- ViewInfo....View.Example:
- /* View the ViewInfo.cmd demonstration command file
- */
- 'attrib ViewInfo.cmd +r'
- 'e.exe ViewInfo.cmd'
- RETURN
-
- CDMenu....Run.Example:
- /* Demonstrate RexxMenu by interactively choosing directory to change to
- */
- CALL CDMenu.cmd
- '@cls'
- '@cd'
- say
- say ' You have used CDMenu to move to a different directory.'
- say ' Big thrill.'
- say
- 'pause'
- RETURN
-
- CDMenu....View.Example:
- /* View the CDMenu.cmd demonstration script
- */
- 'attrib CDMenu.cmd +r'
- 'e.exe CDMenu.cmd'
- RETURN
-
- AttrMenu....Run.Example:
- /* Demonstrate AttrMenu to selectively set, then unset, the archive bit
- */
- '@cls'
- CALL AttrMenu
- say
- 'pause'
- say
- say ' About to remove archive attribute on chosen files in this directory.'
- say
- say ' From the command line, this would be: "AttrMenu * -a" or "AttrMenu -a"'
- say
- 'pause'
- CALL AttrMenu '-a'
- 'pause'
- '@cls'
- say
- say ' About to set archive attribute on chosen files in this directory.'
- say
- say ' From the command line, this would be: "AttrMenu * +a" or "AttrMenu +a"'
- say
- 'pause'
- CALL AttrMenu '+a'
- 'pause'
- RETURN
-
- AttrMenu....View.Example:
- 'attrib AttrMenu.cmd +r'
- 'e.exe AttrMenu.cmd'
- RETURN
-
- VInfoAll....Run.Example:
- /* Select to view from list of all *.INF files on this disk
- */
- '@cls'
- CALL VInfoAll.cmd
- RETURN
-
- VInfoAll....View.Example:
- /* View the VInfoAll.cmd demonstration file
- */
- 'attrib VInfoAll.cmd +r'
- 'e.exe VInfoAll.cmd'
- RETURN
-
- QuikMenR....Run.Example:
- /* Run sample program for accessing common functions using RexxMenu
- */
- '@cls'
- say
- say ' This is a sample of a REXX program, which you might want to'
- say ' put on your desktop, for quickly accessing your commonly used'
- say ' programs or command files. With a couple of keystrokes or'
- say ' mouse-clicks your menu-chosen function is up and running.'
- say
- say ' I use QuikMenR many times a day, and this is the primary'
- say ' reason why I created RexxMenu. This sample is taken from my'
- say ' own desktop, and so not all of the options will work on your'
- say ' system: they may rely on my particular configuration,'
- say ' program-set, and paths. QuikMenR can be easily modified for'
- say ' your own frequently-used functions.'
- say
- '@pause'
- CALL QuikMenR.cmd
- 'mode 80,25'
- RETURN
-
- QuikMenR....View.Example:
- /* View the QuikMenR.cmd example file
- */
- 'attrib QuikMenR.cmd +r'
- 'e.exe QuikMenR.cmd'
- RETURN
-
- QuikMenE....Run.Example:
- /* Run sample program for accessing common functions using EnviMenu
- */
- '@cls'
- say
- say ' This is a sample of batch file using EnviMenu. It is much the'
- say ' as the QuikMenR example, but uses a batch file instead of a REXX'
- say ' file. This is done by calling EnviMenu.cmd, which is a shell around'
- say ' RexxMenu for those who do not want to know they are using REXX.'
- say
- say ' This is a sample of a batch file, which you might want to'
- say ' put on your desktop, for quickly accessing your commonly used'
- say ' programs or command files. With a couple of keystrokes or'
- say ' mouse-clicks your menu-chosen function is up and running.'
- say
- say ' I use QuikMenR many times a day, and this is the primary'
- say ' reason why I created RexxMenu. This sample is taken from my'
- say ' own desktop, and so not all of the options will work on your'
- say ' system: they may rely on my particular configuration,'
- say ' program-set, and paths. QuikMenR can be easily modified for'
- say ' your own frequently-used functions.'
- say
- '@pause'
- 'CALL QuikMenE.cmd'
- 'mode 80,25'
- RETURN
-
- QuikMenE....View.Example:
- /* View the QuikMenE.cmd example file
- */
- 'attrib QuikMenE.cmd +r'
- 'e.exe QuikMenE.cmd'
- RETURN
-
- Solitaire....Run.Example:
- /* Run sample that uses RexxMenu to save KLONDIKE configuration for different users
- */
- CALL Solitair.cmd
- RETURN
-
- Solitaire....View.Example:
- /* View the Solitair.cmd example file
- */
- 'attrib Solitair.cmd +r'
- 'e.exe Solitair.cmd'
- RETURN
-
- Prompts....Run.Example:
- /* Uses the MenuPick.cmd utility to select Command Processor sessions
- */
- 'CALL Prompts.cmd'
- RETURN
-
- Prompts....View.Example:
- /* view Prompts.cmd, which uses the MenuPick utility
- */
- 'attrib Prompts.cmd +r'
- 'e.exe Prompts.cmd'
- RETURN
-