you could make a menu with choice/errorlevel and subroutines to run what they select
but its a crapload of code to write
enter the number of the printer you want to install
1) win xp - HR - hp 3450
...
44) win 7 - sales - canon mp3
would be easier to make it in jscript assuming your using internet explorer on your intranet, so it can run exe's
Take webpage input to generate and run a batch file...
Moderator: DosItHelp
Re: Take webpage input to generate and run a batch file...
It's not clear if you would accept a batch file with a menue, but i've just found an old batch, that can easily be adjusted, to create a printer menu:
This is not my final version, so it is unsave in many ways, but it should work.
penpen
Code: Select all
:programEntryPoint
@echo off
setlocal enableDelayedExpansion
call :newMenu MENU
set "MENU.TITLE=Please select a printer to install, or quit."
call :addMenuItem MENU "win xp - HR - hp 3450" "echo:install command 1"
:: more printers...
call :addMenuItem MENU "win 7 - sales - canon mp3" "echo:install command n"
call :showMenu MENU
endlocal
goto:eof
:newMenu
:: %1 menu name
::
set "%1=class Menu"
set "%1.LENGTH=0"
set "%1.TITLE=Menu:"
set "%1.EMPTY=No menuitems available."
set "%1.CHOOSE=Please choose: "
set "%1.QUOTES=Double quotes are not allowed."
set "%1.CHOICE=The choosen input is not available."
set "%1.EXECUTE=Execute:"
goto:eof
:addMenuItem
:: %1 menu name
:: %2 menu entry encapsulated in doublequotes
:: %3 executeable encapsulated in doublequotes
::
set /a "%1.LENGTH+=1"
set "%1.ITEM[!%1.LENGTH!].NAME=%~2"
set "%1.ITEM[!%1.LENGTH!].ACTION=%~3"
goto:eof
:showMenu
:: %1 menu name to that holds the actual menue
setlocal enableDelayedExpansion
set "INPUT="
set "ITEM.NAME="
set "ITEM.ACTION="
set "INFO_MESSAGE="
:printMenu
cls
echo:!%1.TITLE!
if !%1.LENGTH! == 0 echo:!%1.EMPTY!
for /l %%a in (1,1,!%1.LENGTH!) do echo:%%a^) !%1.ITEM[%%a].NAME!
echo:Q/q^) to quit.
if defined ITEM.NAME (
echo:
echo:Title: %ITEM.NAME%
echo:Action: %ITEM.ACTION%
echo:!INFO_MESSAGE!%
%ITEM.ACTION%
set "ITEM.NAME="
set "ITEM.ACTION="
) else if defined INFO_MESSAGE (
echo:
echo:Last input: "%INPUT%"
echo:!INFO_MESSAGE!%
)
echo:
set "INPUT="
set /p "INPUT=!%1.CHOOSE!"
if not defined INPUT (set "INFO_MESSAGE=!%1.CHOICE!" & goto:printMenu)
set CHECK_QUOTES=!INPUT:%INPUT:"=%=!
if defined CHECK_QUOTES (set "INFO_MESSAGE=!%1.QUOTES!" & goto:printMenu)
if "Q" == "%INPUT%" goto:exitMenu
if "q" == "%INPUT%" goto:exitMenu
set "INFO_MESSAGE=!%1.CHOICE!"
for /l %%a in (1,1,!%1.LENGTH!) do if "%%a" == "%INPUT%" (
set "ITEM.NAME=!%1.ITEM[%INPUT%].NAME!"
set "ITEM.ACTION=!%1.ITEM[%INPUT%].ACTION!"
set "INFO_MESSAGE=!%1.EXECUTE!"
)
goto:printMenu
:exitMenu
endlocal
goto:eof
This is not my final version, so it is unsave in many ways, but it should work.
penpen