Running a Script by Pressing a Key
It is possible to launch a script every time a specific key (or key combination) is pressed. OnAction WinTask x64 function is used for that.
This sample script Launcher.src runs the script called "message" each time you press Alt + F10.
'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
'Definition of the key to press for launching the script
'Name of the script to run (if not in the same directory, include the full path in the name)
'Definition of OnAction statement : every time the specified key is pressed, the sub-routine is launched
'Script stays alive
You can set up the script Launcher.src to be launched at Windows startup (the 64 bit automation product is needed if your Windows is a 64 bit system):
While editing the script in the WinTask x64 editor, select the menu option File/Create desktop shortcut (on a 64 bit Windows, this menu option is available only with the 64 bit automation product). 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 x64 to listen for the shortcut key. The embedded script runs only if the shortcut key is pressed.