Running a Script by Pressing a Key
It is possible to launch a script every time a specific key (or key combination) is pressed. This is accomplished by the use of the OnAction statement which is not available in WinTask Lite.
The sample script Launcher.src is given below.
'This script launches another script every time a specific key is pressed.
'This script can be launched at Windows startup if it is included in Windows startup group
'Definition of the subroutine which must be executed every time the specified key is pressed
'In this example, the script named in variable script1$ is launched
sub start_script1()
run(script1$)
endsub
'Definition of the key to press for launching the script
key_start1$="<Alt <F10>>"
'Name of the script to run (if not in the same directory, include the full path in the name)
script1$="affiche"
'Definition of OnAction statement : every time the specified key is pressed, the sub-routine is launched
OnAction start_key1s
Key(key_start1$)
DoSub start_script1
EndAction
'Script stays alive
sleep()
You can set up the script Launcher.src to be launched at Windows startup:
While editing the script in the WinTask editor, select the menu option File/Create desktop shortcut.
Move the shortcut from your desktop to the Windows Startup folder.
Remember, setting up a Launcher script this way does not launch the embedded script upon Windows startup; it merely tells WinTask to listen for the shortcut key. The embedded script runs only if the shortcut key is pressed.