@echo off&set FileName=%~n0&shift :: ============================================= :: AutoHelp PlugLab Concept: 2006 by Reatogo :: ============================================= :: Help Info: :: ======================= set Routine_Type=2 :: 1=Getting Data 2=Prompts 3=Getting Files 4=Creating Files 5=General set Routine_Vers=1 set Routine_Date=2007-02-15 set RoutineName=Combo set RoutineAuthor=Siegfried set Using_work_from= set Example_call_1=%%COMBO%% "3" "Select the driver ..." "COMBO_D_1.dat" "COMBO_T_1.dat" "Choice Number 8" set Example_call_2= set Example_call_3= set text_01=Selection dialog for an unlimited no. of choices. set text_02=. set text_03=Param 1: 1=next, 2=next cancel, 3=back, next, cancel set text_04=Param 2: Topbar text set text_05=Param 3: a text file with the choices set text_06= Example: set text_07= ChoiceNumber1=cdeject.exe set text_08= UpdatePNP.dll set text_09= ChoiceNumber3=vpcshexg.dll set text_10= ChoiceNumber4=vmsrvc.exe set text_11=Either display and return mapped like in choice 1 set text_12=or display an return the same like in choice 2 set text_13=. set text_14=Param 4: a text file with the info text set text_15=Param 5: default choice. If left empty = choice no. 1 set text_16=. set text_17=The text files must be in SCRIPTS\DATs set text_18=. set text_19=Returns: set text_20= 1. The choice as %%result%% set text_21= 2. back, next or cancel as %%BTN%% if "%~1" == "GetHelp" goto :EOF echo.&echo %* :: ============================================= set result= set result2= set BUTTON_QTY=%~1 set BUTTONSET= if "%~1" == "1" set BUTTONSET=NOBACK NOCANCEL if "%~1" == "2" set BUTTONSET=NOBACK if "%~1" == "3" set BUTTONSET= shift set WAtitle=%~1&shift set temp_StringList=%~1&shift set StringList=%DATs%\%temp_StringList% :: skip header if ini or inf set INI_SKIP= if "%temp_StringList%" == "LANG.ini" set INI_SKIP=skip=1 set LANG_CASE= if "%temp_StringList%" == "LANG.dat" set LANG_CASE=yes if "%temp_StringList%" == "LANG.ini" set LANG_CASE=yes if "%WAtitle%" == "" if "%LANG_CASE%" == "yes" set WAtitle=Select the Language set Text_file=%DATs%\%~1&shift set WAoutput=%~1 if "%WAoutput%" == "" ( for /f "%INI_SKIP%tokens=1-2* delims==" %%a in (%StringList%) do ( set WAoutput=%%a if not "%%a" == "" goto COMBO_LABLE_1 ) ) :COMBO_LABLE_1 set WAfile=%temp%\COMBO_D_TEMP.txt :: Create COMBO_D_TEMP.txt if exist "%temp%\COMBO_D_TEMP.txt" del "%temp%\COMBO_D_TEMP.txt" for /F "%INI_SKIP%tokens=1-2* delims==" %%i IN (%StringList%) do ( if not "%%i" == "[LANGUAGE]" echo %%i>> "%temp%\COMBO_D_TEMP.txt" ) :: Set the text variables if "%Text_file%" == "%DATs%\" set WAtext=~Select the language for this plugin.&goto COMBO_LABLE_4 if exist "%temp%\TempLab.cmd" del "%temp%\TempLab.cmd" SETLOCAL ENABLEDELAYEDEXPANSION set a=0 for /F "tokens=*" %%i IN (%Text_file%) do ( set /a a+=1 if "!a!" == "1" echo set WAtext=~%%i >> "%temp%\TempLab.cmd" if not "!a!" == "1" echo set WAtext!a!=~%%i >> "%temp%\TempLab.cmd" if not "!a!" == "1" if "%%i" == "." echo set WAtext!a!=~ >> "%temp%\TempLab.cmd" ) ENDLOCAL call "%temp%\TempLab.cmd" del "%temp%\TempLab.cmd" :COMBO_LABLE_4 %MSG% :: ============ set WAbat=%temp%\TempLab.cmd "%APPS%\WIZapp.exe" %BUTTONSET% CB if errorlevel 2 set BTN=cancel&goto COMBO_LABLE_2 if errorlevel 1 set BTN=back&goto COMBO_LABLE_2 if errorlevel 0 set BTN=next&goto COMBO_LABLE_2 :COMBO_LABLE_2 call "%temp%\TempLab.cmd" del "%temp%\TempLab.cmd" set result=%WAoutput% if exist "%temp%\COMBO_D_TEMP.txt" del "%temp%\COMBO_D_TEMP.txt" :: ============ SETLOCAL ENABLEDELAYEDEXPANSION :: array set a=0 for /F "tokens=1-2* delims==" %%i IN (%StringList%) do ( set /a a+=1 set displ[!a!]=%%i if not "%%j" == "" (set sel[!a!]=%%j) else set sel[!a!]=%%i ) :: pick result from array set a=0 :COMBO_LABLE_3 set /a a+=1 if "%result%" == "!displ[%a%]!" ( set result=!sel[%a%]! set result2=!displ[%a%]! goto COMBO_LABLE_4 ) if "%a%" == "50" goto COMBO_LABLE_4 goto COMBO_LABLE_3 :COMBO_LABLE_4 echo set result=%result%> "%temp%\TempLab.cmd" echo set result2=!result2!>> "%temp%\TempLab.cmd" ENDLOCAL :: import result call "%temp%\TempLab.cmd" del "%temp%\TempLab.cmd" if "%temp_StringList%" == "LANG.ini" set LANG=%result% if "%temp_StringList%" == "LANG.dat" set LANG=%result% %RESET_VARS% set INI_SKIP= set LANG_CASE= goto :EOF :: =============================================