onlyforbopi
10/11/2018 - 1:13 PM

DOS GUI

DOS - INPUT BOX YES/NO

 call :MsgBox "Would you like to go to URL?"  "VBYesNo+VBQuestion" "Click yes to go to URL"
    if errorlevel 7 (
        echo NO - don't go to the url
    ) else if errorlevel 6 (
        echo YES - go to the url
        start "" "http://www.google.com"
        :: or other logic
        :: or goto :after
    )
    
:::after



:::::::at end of file

:MsgBox prompt type title
    setlocal enableextensions
    set "tempFile=%temp%\%~nx0.%random%%random%%random%vbs.tmp"
    >"%tempFile%" echo(WScript.Quit msgBox("%~1",%~2,"%~3") & cscript //nologo //e:vbscript "%tempFile%"
    set "exitCode=%errorlevel%" & del "%tempFile%" >nul 2>nul
    endlocal & exit /b %exitCode%

call :inputbox "Please enter the Process Date:" "FINACITY PROCESS DATE"
echo You entered process date: %Input%




:InputBox
set input=
set heading=%~2
set message=%~1
echo wscript.echo inputbox(WScript.Arguments(0),WScript.Arguments(1)) >"%temp%\input.vbs"
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"') do set input=%%a
exit /b
CALL:notify10 "150" "SCRIPT EXECUTION SUCCESS"
CALL :error10 "155" " BULKFILE DOWNLOAD FAILED: %ERRORLEVEL% "




:error10
SETLOCAL
SET Line=%~1
SET Msg=%2
ECHO.
ECHO ATTENTION : FATAL ERROR : %Msg% ON LINE %Line%
ECHO TERMINATING SCRIPT
echo X=MsgBox( %Msg% ,0+16,"FATAL ERROR ON LINE %Line%") >%SCRIPTDIR%msg.vbs
wscript %SCRIPTDIR%msg.vbs
DEL %SCRIPTDIR%msg.vbs
REM echo %Msg% ::::: Line : %Line% > %LASTRUNLOG%
REM ::GOTO ERRORNOTIFYMAIL
EXIT /b

:warning10
SETLOCAL
SET Line=%~1
SET Msg=%2
ECHO %Msg%
echo X=MsgBox( %Msg% ,0+48,"WARNING ON LINE %Line%") >%SCRIPTDIR%msg.vbs
wscript %SCRIPTDIR%msg.vbs
DEL %SCRIPTDIR%msg.vbs
EXIT /b

:notify10
SETLOCAL
SET Line=%~1
SET Msg=%2
REM ECHO %Msg%
echo X=MsgBox( %Msg% ,0+64,"NOTIFICATION ON LINE %Line%") >%SCRIPTDIR%msg.vbs
wscript %SCRIPTDIR%msg.vbs
EXIT /b


:: Two ways, either create it on the spot and call it in a function : ie
:error10
SETLOCAL
SET Line=%~1
SET Msg=%2
ECHO.
ECHO ATTENTION : FATAL ERROR : %Msg% ON LINE %Line%
ECHO TERMINATING SCRIPT
echo X=MsgBox( %Msg% ,0+16,"FATAL ERROR ON LINE %Line%") >msg.vbs
wscript msg.vbs
DEL msg.vbs
EXIT /b

call :error10 "20" "%Build%"


::::::::::::::::::::::::::::::::::::::::::::::::::::
:: OR CREATE A VBS AND CALL IT 

::VBS :

Set objArgs = WScript.Arguments
messageText = objArgs(0)
MsgBox messageText

:: call as : 

cscript %MSGBOX% "%Build%"
wscript %MSGBOX% "%Build%"