{key}
Sample Usage
-Kind Regards{key:shift-tab}{key:enter}
Quick Overview VideoSettings
Setting Name Type Description Positional text The key press to simulate. mac text Override key press when on a Mac win text Override key press when on Windows linux text Override key press when on Linux cros text Override key press when on a ChromeBook General Command Settings trim yes/no/left/right If yes
whitespace is removed before and after the command. If left
, only whitespace to the left is removed. If right
, only whitespace to the right is removed.
Setting Name | Type | Description |
---|---|---|
Positional | text | The key press to simulate. |
mac | text | Override key press when on a Mac |
win | text | Override key press when on Windows |
linux | text | Override key press when on Linux |
cros | text | Override key press when on a ChromeBook |
General Command Settings | ||
trim | yes/no/left/right | If yes whitespace is removed before and after the command. If left , only whitespace to the left is removed. If right , only whitespace to the right is removed. |
The {key}
command allows you to emulate a key press on the current page. For example, you can do {key: s}
to simulate pressing the s
key which will output an s
character into the text field.
But, the most common use case is utilizing the {key}
command to trigger shortcuts ({key: ctrl-s}
), move the focus to another element ({key: tab}
), or submit a form ({key: enter}
). Click here to see more examples for the key command.
The syntax for the {key}
command's positional setting is modifier-character
. A character
is the key that is pressed (e.g. s
or a non-character like tab
). The modifier
, which is optional, is a key like shift
key or the ctrl
key. For example: {key: shift-tab}
is utilizing both a modifier key and a character key.
Click here to see an example of automating writing your email utilizing the {key}
command and form commands.
Modifiers
The following modifiers are supported:
Key | Modifier |
---|---|
Shift Key | shift |
Control Key | ctrl |
Alt (Option) Key | alt |
Command (Meta) Key | cmd |
Also, it's possible to use multiple modifiers joined together with hyphens. For example ctrl-shift-x
or alt-shift-tab
.
Non-Character Keys
In addition to key presses that can be represented with a standard keyboard character (e.g. {key: s}
or {key: p}
), the following non-character keys are supported:
Key | Key Token |
---|---|
Tab Key | tab |
Enter Key | enter |
Backspace Key | backspace |
Left Arrow Key | leftarrow |
Right Arrow Key | rightarrow |
Up Arrow Key (experimental) | uparrow |
Down Arrow Key (experimental) | downarrow |
An example of usage of these keys would be {key: tab}
to tab to the next field in the webpage (or {key: shift-tab}
to tab to the prior field in the document). The remainder of the snippet would then be entered in that field, allowing you to fill out multiple fields with a single snippet.
The enter
key is also useful for pressing a button to submit a form or trigger some action. tab
and enter
key commands can often be used sequentially to enable a variety of scripting behaviors.
Click here to see a real-world example utilizing the {click}
and {key}
autopilot commands.
Supporting Multiple Operating Systems
Key presses may be different on different operating systems. For example, saving a file may be ctrl-s
on a Windows computer, but cmd-s
on a Macintosh computer.
Text Blaze lets you define different key presses for each operating system via the optional win
, mac
, linux
and cros
override settings. When one of these is defined and the snippet is used on that operating system, Text Blaze will use the key press you defined for that operating system, rather than the default key press, which you define in the first positional setting.
For example, if you want to use ctrl-s
on Windows, Linux or ChromeBooks; but cmd-s
on a Macintosh computer, you could use the following:
This is most useful if you're using Text Blaze with your team and sharing snippets with them that will be used on a variety of operating systems.
To learn more about automating actions in a web page, see the autopilot guide.