|
Send Keystrokes Action |
Description
|
|
|
For further information on sending keys and special key codes, please see Special Keys and Their Equivalents
For further information on controlling the speed at which keystrokes are sent, please see the Tolerances section of AutoMate Preferences
Parameters
Keystrokes
The literal keystrokes that AutoMate should send to the currently focused window. Case is preserved, so if you want to send the value "Steve" is not necessary to enter the code for the shift key, rather simply enter "Steve" (without quotes).Insert (button)
Displays a drop-down list of all special keys such as ALT, CTRL, SHIFT, etc. This allows for quick selection of keystrokes without the need to remember the special codes for each key. Upon selecting an item, the appropriate key code will automatically be inserted into the keystrokes text box at the current cursor position.Field (button)
Displays a drop-down list of all special fields which may be embedded inside a keystroke sequence. The following Fields are available to select:Shortdate: Inserts a code that resolves to the current date when the step is executed. The date will be sent in the format you have configured as the "Short date format" in the Windows Regional Options.
LongDate: Inserts a code that resolves to the current date when the step is executed. The date will be sent in the format you have configured as the "Long date format" in the Windows Regional Options.
Time (12 Hour Format): Inserts a code that resolves to the current time when the step is executed. The time will be sent using a 12 hour clock in the format you have specified in the Time format section the Regional Options.
Time (24 Hour Format): Inserts a code that resolves to the current time when the step is executed. The time will be sent using a 24 hour clock in the format you have specified in the Time format section the Regional Options.
Custom Date: Inserts a code that resolves to the current date and/or time when the step is executed. This option allows you to specify the format you would like the value to be sent. Regional options are ignored.
Delay: Inserts a {DELAY x} code. Change the value of x to change the amount of delay (in milliseconds) before continuing on in the keystroke sequence.
Variable: Displays a dialog drop down box of all the variables currently in your task (this is determined by scanning the task for existing Create Variable steps), upon selecting a variable name it will be embedded in your keystrokes. The variable will be resolved at runtime so that the current value of the variable is sent.
Constant: Displays a dialog drop down box of all the constants currently configured in AutoMate (configured in the AutoMate Preferences), upon selecting a constant name it will be embedded in your keystrokes. The constant will be resolved at runtime to it's current value.
Keystroke Reference
Displays a help file page that shows a list of custom keys and their matching code for use in the keystrokes parameter. It is usually more efficient to simply use the Insert button.
Add a pause before send: X ms.
The amount of time in milliseconds to wait when the step is executed before actually sending the keystrokes. This is enabled by default to give the application time to be ready to receive input before the keystrokes are sent. You may need to adjust this value depending on the applications load time, current state, and system speed.
Notes
Keystrokes must have a target application to execute upon. This means that you cannot use System Wide keystrokes such as Alt+Tab or Ctrl+Alt+Del etc.
Key codes are case sensitive. Do not use capital letters with %, ^, or + unless you specifically intend to send a capital letter (implied SHIFT). Simply type the letters that you wish to be sent in uppercase as uppercase values and those intended as lowercase as lower case values.
You may need to wait a few seconds before sending your keystrokes (while waiting for a window to appear, for example). To do this, check the “Add pause before send” and enter the number of milliseconds to pause (1000 ms = 1 second). This will cause AutoMate™ to wait the specified amount of time before beginning to “type”.
All that you need to know in order to send keystrokes to an application is which keys you would press to get what you want done. One may think that some things are not possible without a mouse, but every well designed Windows program has keyboard shortcuts and hot keys that will allow you to, with the keyboard, perform any action that can be performed with a mouse. The secret is simply experimentation. Using Send Keystrokes as opposed to Mouse clicks is much more reliable due to the fact that it does not rely on window positioning or size.
Most keyboard shortcuts are made visible underlining the character necessary to press (simultaneously with <alt>) in order to execute the button / command / function, etc. For example, from this Help File, you would hold the <alt> key down and press p to Print Topic.
The Send Keystrokes action can emulate most of the special keys on the keyboard (such as the Scroll Lock and Caps Lock keys), and also supports “fields,” special text surround by braces that are replaced at run time by a dynamic value. Consult the help file sections on Special Keys and Their Equivalents for emulating special keys, and the section on Keystroke Fields for more information on supported AutoMate™ fields.
Example
To send keystrokes, perform the following steps
Select the Send Keystrokes action from the list of actions in the Step Builder.
Type the keys that you would like to be sent into the text box labeled “Keystrokes”.
Click OK to add the new step to your task.
The example below illustrates the process of launching Notepad, typing out some text into the application, and then saving that file to your hard disk.
While in the Step Builder, double click the “Start An Application” step. Enter the path to notepad.exe, i.e. c:\windows\notepad.exe, or select the Browse option and search for the file in your system. This will start Notepad when the task is triggered.
Next, we need to establish the focus on Notepad to be sure that it receives the keys being sent. To do this, select the Focus Window step (located in the Windows submenu on the left-hand side of the Step Builder). In the text box marked “Window Title”, enter the words “Untitled – Notepad” (NOTE: Case sensitive entry). This will search for the window with that text and focus it. Click Ok to add the step.
Now we need to tell AutoMate™ what keystrokes we want to type into Notepad. Double click the “Send keystrokes” action, and in the area marked “Keystrokes”, type in the text as you want it to appear in Notepad. When you are finished entering your text, type in %f. AutoMate™ will interpret this as an Alt-f keystroke to invoke the file menu. Next enter an "s" to select save, then type the name of the file to save. Enter a "~" sign (the shortcut for the Enter key) and you are done. For example, your text may look like this:
To whom it may concern,~~This is an example macro.%fsMy Notes.txt~
That’s it! Whenever the task is triggered, notepad will open, your text will be typed into it, and it will be saved to file entitled “My Notes.txt”.
Related Topics: