I have been thinking about a great real-world example of a script to do a simple launcher..
You can go as simple as a batch file or a full-featured AutoIT Script that is compiled into an executable..
We’ll keep this simple and just use Windows notepad.exe and calc.exe for now..
In Batch, we have (Note: in ASE, you will need to change the behavior to “Execute via shell”) :
@echo off
Color e0
Cls
:menu
@Ping 127.0.0.1 -n 3 -w 1000 > nul
echo.
echo Menu options:
echo.
echo 1 Notepad
echo 2 Calculator
echo.
echo x Exit
echo.
Set /p userc= What would you like to DO?
If "%userc%"=="1" Goto notepadrun
If "%userc%"=="2" Goto calcrun
If /i "%userc%"=="x" Goto exitnow
echo %userc% is an invalid choice
Goto menu
:notepadrun
notepad.exe
echo.
echo Returning to Main Menu..
@Ping 127.0.0.1 -n 1 -w 1000 > nul
Cls
Goto menu
:calcrun
calc.exe
echo.
echo Returning to Main Menu..
@Ping 127.0.0.1 -n 1 -w 1000 > nul
Cls
Goto menu
:exitnow
echo Exiting menu..
@Ping 127.0.0.1 -n 1 -w 1000 > nul
Cls
Exit
Even though that is a simplistic example, there is a lot of code there..
Filed under: Scripting | 3 Comments »