[snip]
Yeah <sigh>, but it seems rather inelegant.
You could introduce the Q key (QUIT without doing anything).
I slightly altered the batch :
@echo off
if GOTO:==%1 %1%2 (Subroutine Handler)
for %%? in (a b c d e f g h i j k l) do set %%?=_
[snip]
Here it is below, a very fantastic batch file courtesy of Todd Vargas
of alt.msdos.batch. He kindly put a ton of effort as well as a member
here of our ng who prefers not to be mentioned, but who deserves
credit for a modification in passing even if not in name <g>!
It's a rare animal, this bat file, as it's a multiple choice one where
after launching, the user can select which item(s) to launch at that
given moment. If any of you have experienced other app launchers,
they are very restrictive. They allow _only_ a set group of several
apps to be launched at once with no possibility, really, of variation.
And none offer such flexibility as this one.
I have at least one situation where a total of 12 files need launching
at any given time. Literally, though, this changes from moment to
moment. I don't need to open any one, except one out of the 12, each
an every single time. This was a way around this.
1) To make this work, the most major editing is just to change the
"item # (1, 2, 3...) to launch" in 2 areas, within the menu box and in
the ":continue" area to reflect pathname of file or folder to launch.
A bit obvious, but worth mentioning, the numbers should coincide.
i.e., "item 1 to launch" in the menu box, should correspond to the
"item 1 to launch" in the ":continue" area so that your choice
launches the right thing.
2) As noted in the first lines of the bat, if you want the DOS box to
close upon finishing the task, merely launch this BAT from a PIF file
isntead of from the BAT directly. Then once you've created the PIF,
go into the properties box and in the Program tab, make sure CLOSE ON
EXIT is selected.
3) If you need to add more items than 12 this can accommodate, easy
to do, however there are 2 lines of command, I think that's all, to
change:
The 1st line is:
CHOICE /C:ABCDEFGHIJKLQX /N " Choose your option(s), then press X. Or
press Q to quit.: "
Q is for Quit and X is for launching, so just make sure that you also
add on letters after the "L" above so that you'll have all the letters
needed between the "...GHIJKL--" and "--QX /N...".
The 2nd line is in ":cleanup":
Add any extra letters after the "...j k l" and before the end bracket:
:cleanup
for %%? in (a b c d e f g h i j k l) do set %%?=%=%
Just a note, an enter command might have been more standard and easier
for the user instead of the "X" to launch after user input, but that
would have required either a 3rd party app or editing of Win98SE,
somehow, can't remember what it was. It didn't seem worth it, so the
"X" was kept and I just added a bit more explanatory text.
This is a standalone bat, as is, and should be easy enough to
re-configure for other OSs.
Good luck and thanks to Todd for this one!
(You can either edit in notepad or use the dos editor, if your OS has
it.)
************************
@echo off
:: Was PizzaMenu.bat, posted in newsgroup alt.msdos.batch
:: Written by Todd Vargo in Windows 98 on Sep 23, 2003 (but should work in other OSs)
:: Modified by Todd Vargo on Sep 25, 2003 for personalized usage
:: A thousand thanks, Todd!!
:: Modified by FitWell on Weds.,Oct.08.2003 for generic use (+ added more user instructions)
:: If you re-publish _anywhere_, pls leave credits but also personalize on this line
:: [If you would like the DOS box to close after task finished, make a shortcut of
:: the .BAT file and then in the properties of the resulting .PIF file, select the
:: "Close on exit" option (in Win98SE this is in the PROGRAM tab of the properties box).]
if GOTO:==%1 %1%2 (Subroutine Handler)
for %%? in (a b c d e f g h i j k l) do set %%?=_
:menu
cls
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º APPS TO LAUNCH º
echo ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹
echo º A. [%a%] - item 1 to launch º
echo º B. [%b%] - item 2 to launch º
echo º C. [%c%] - item 3 to launch º
echo º D. [%d%] - item 4 to launch º
echo º E. [%e%] - item 5 to launch º
echo º F. [%f%] - item 6 to launch º
echo º G. [%g%] - item 7 to launch º
echo º H. [%h%] - item 8 to launch º
echo º I. [%i%] - item 9 to launch º
echo º J. [%j%] - item 10 to launch º
echo º K. [%k%] - item 11 to launch º
echo º L. [%l%] - item 11 to launch º
echo º º
echo º Q. QUIT - changed your mind? Just Quit. º
echo º º
echo º X. Start launch process. º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo. If you change your mind about a selection, press the key
echo. again to toggle it off.
echo.
CHOICE /C:ABCDEFGHIJKLQX /N " Choose your option(s), then press X. Or
press Q to quit.: "
IF ERRORLEVEL 14 GOTO continue
IF ERRORLEVEL 13 if not errorlevel 14 GOTO cleanup
IF ERRORLEVEL 12 if not errorlevel 13 call %0 GOTO: toggle L %L%
IF ERRORLEVEL 11 if not errorlevel 12 call %0 GOTO: toggle K %K%
IF ERRORLEVEL 10 if not errorlevel 11 call %0 GOTO: toggle J %J%
IF ERRORLEVEL 9 if not errorlevel 10 call %0 GOTO: toggle I %I%
IF ERRORLEVEL 8 if not errorlevel 9 call %0 GOTO: toggle H %H%
IF ERRORLEVEL 7 if not errorlevel 8 call %0 GOTO: toggle G %G%
IF ERRORLEVEL 6 if not errorlevel 7 call %0 GOTO: toggle F %F%
IF ERRORLEVEL 5 if not errorlevel 6 call %0 GOTO: toggle E %E%
IF ERRORLEVEL 4 if not errorlevel 5 call %0 GOTO: toggle D %D%
IF ERRORLEVEL 3 if not errorlevel 4 call %0 GOTO: toggle C %C%
IF ERRORLEVEL 2 if not errorlevel 3 call %0 GOTO: toggle B %B%
IF ERRORLEVEL 1 if not errorlevel 2 call %0 GOTO: toggle A %A%
GOTO menu
:toggle
if _==%4 for %%? in (%3) do set %%?=X
if X==%4 for %%? in (%3) do set %%?=_
GOTO end
:continue
if X==%a% start "item 1 to launch"
if X==%b% start "item 2 to launch"
if X==%c% start "item 3 to launch"
if X==%d% start "item 4 to launch"
if X==%e% start "item 5 to launch"
if X==%f% start "item 6 to launch"
if X==%g% start "item 7 to launch"
if X==%h% start "item 8 to launch"
if X==%i% start "item 9 to launch"
if X==%j% start "item 10 to launch"
if X==%k% start "item 11 to launch"
if X==%l% start "item 12 to launch"
:cleanup
for %%? in (a b c d e f g h i j k l) do set %%?=%=%
cls
echo.
echo.
echo TASK COMPLETED.
echo.
echo.
:end
::end of batch