Tasker Script Reference |
Keyword | CLICK |
Purpose | Click the mouse at specified coordinates on the active window |
Syntax & Comments | CLICK [horizontal coordinate X] , [vertical coordinate Y] * This command simulates a left mouse click based on the windows coordinates (0,0 is the upper left corner). * NOTE: Use the GOTO command before using this command so that the correct window is activated. * To click the mouse on the desktop, use the command "GOTO Program Manager" before using CLICK. |
Example |
; Launch the Paint application ; In Windows ME this next line might be something like "C:\Program Files\Accessories\mspaint.exe" START mspaint.exe ; Give Paint a couple of seconds to start up WAIT 2 seconds ; Switch to the Paint application GOTO untitled - Paint ; Now, click the mouse in the drawing (it should leave a small pen mark) CLICK 100, 100 |
Keyword | GOTO |
Purpose | Find a running program (such as Notepad or Excel) and make it the active application Also serves as a validation check during playback (like an IF statement), and can terminate a script if necessary |
Syntax & Comments | GOTO [window title text] * The window text can be a partial match and GOTO will still work. For example, "GOTO sales" will find a window with the title of "Year Sales.txt - Notepad" * No quotes or other delimiters are required. All text is interpreted literally. * This command takes approximately 1/3 of a second to execute. * If the window cannot be found, the playback will immediately terminate. * NOTE: You should use GOTO regularly as a safety check in script files to be sure that your actions are occurring in the correct window. |
Example |
; Launch the Notepad application START notepad.exe ; Give Notepad a second to start up WAIT 1 second ; Switch to the Notepad application and put the cursor in its window GOTO Untitled - Notepad |
Keyword | START |
Purpose | Launch a program such as Notepad or Excel |
Syntax & Comments | START [executable name] * In case the program cannot be started, include the entire directory path with the program name. You can get this path by right mouse clicking on the shortcut icon and viewing the Properties. For example, Microsoft Word may require a path such as "C:\Program Files\Microsoft Office\Office10\WINWORD.EXE" for Office XP. * If the program cannot be started, the playback will immediately terminate. * 16-bit MS-DOS programs cannot be run with this command directly, but can be properly handled with script commands. See below in the Example Code. |
Example |
; Launch the Notepad application START notepad.exe WAIT 1 second GOTO Untitled - Notepad |
Keyword | TYPE | |||||||||||||||||||||||||||||||||||
Purpose | Send some text to be entered in the keyboard buffer | |||||||||||||||||||||||||||||||||||
Syntax & Comments | TYPE [single line of text] * No quotes or other delimiters are required. All text is interpreted literally. * The maximum size of the string that may be typed on a single line is 1,000 characters. * NOTE: Use the GOTO command before using this command so that the correct window is activated. * There is no delay between character output because the entire buffer is placed into the keyboard queue immediately. * The following codes can be put in to generate dynamic input during playback:
Here are the codes for the special keyboard characters:
* NOTE: Only one special character keyword can be used in each TYPE line. This means that "{altdown}" and "{altup}" must be on separate TYPE lines. The exceptions to this rule are {enter/newline/return}, {space}, and {tab} (because they are printable characters. * If you put "{enter} / {newline} / {return}" in the script and the playback occurs in a popup dialog box, the system may use the Return character (the Enter Key) to press the default button. This can be used as a feature to close dialog boxes. * See the samples scripts for proper usage of the special keyboard characters listed above. | |||||||||||||||||||||||||||||||||||
Example |
; Launch the Notepad application, wait for it to start, then switch to it START notepad.exe WAIT 1 second GOTO Untitled - Notepad ; Press some keys TYPE Here is text that is being typed by Tasker {newline}{newline} ; Here's dynamic text that is generated during playback: TYPE Random={random} Date={date} Time={time} Date/Time As Number={dtnumber} Playback #={playbackloop} ; It will look like this after output: ; Random=6384 Date=01/06/2002 Time=01:34:10 Date/Time As Number=200201060134100606 Playback #=1 ; Show the File menu (Alt+F) to demonstrate special characters: TYPE {altdown} TYPE f TYPE {altup} |
Keyword | WAIT |
Purpose | Pause a certain amount of time before running the next command |
Syntax & Comments | WAIT [number of seconds] * The word "seconds" is optional. * This command is useful to give a large program enough time to load before switching to it. Sorry, but there is no other completely reliable way for Tasker to verify if a program has completed all of its initialization procedures. * WAIT is affected by the Playback Speed option (previously, all WAIT delays ignored the Speed and played at the Normal setting) * To WAIT less than one second (fractions of a second), you can use the Fast Factor (in Advanced Options) when combined with the Fast Speed playback. For example, to do a delay of half of a second, you can set the Fast Factor to 2x speed, and then play back at the Fast playback speed. 1 second will become 1/2 of a second. If the factor is set to 4x, 1 second becomes a quarter second. * WAIT does not use the Windows "Sleep" command, but thread event timing methods, therefore background processing continues. |
Example |
START notepad.exe ; Give Notepad a second to start up WAIT 1 second GOTO Untitled - Notepad |
Keyword | (Command Line Parameters) |
Purpose | Control execution of a Tasker Script File (.TSX) or Recording (.TSK) |
Syntax & Comments |
/SPEED=[1, 2, 3, or 4] /REPEATS=[any positive whole integer] /CONTINUOUS=[1 or 0 (Boolean)] * Please refer to the Tasker User's Guide for further information and usage examples. * The command line parameters are not technically a part of Tasker Script, but they are the only method for programmatically controlling loops and playback speed. * These parameters do not have any effect on compiled .EXE programs that were created by Tasker. * The command line parameters do not alter any stored Tasker configurations - Tasker will start up with its previous settings. |
Example |
The Tasker User's Guide has detailed step-by-step instructions on how to accomplish this, and includes sample screen shots. |