Hold Down Key Action

Declaration

<AMKEYDOWN SHIFT="yes/no" CTRL="yes/no" ALTGR="yes/no" ALT="yes/no"  WINKEY="yes/no">

See Also

Hold Down Key Action-Setting Properties, Release Key Action, Send Keystrokes Action, Move Mouse Action

Description

Holds the specified key(s) down until a "Release Key" <AMKEYUP> action is specified in the task.

In 95% of cases this action is not needed, Send Keystrokes can hold down keystrokes for simple key combinations such as ALT-f.  This action is only needed when a key or keys need to be held down during a mouse operation or across multiple steps. Otherwise the "Send Keystrokes" <AMSENDKEYS> action should be used as it supports holding down of special keys also.

Practical Usage

Generally the "Hold down key" action is used in conjunction with the Release Key Action <AMKEYUP> action to hold down special keys spanning multiple steps. For example if the application being automated requires that the ALT key be held down while mouse clicks are taking place that task could begin with this step to hold down the ALT key, followed by the Mouse <AMMOUSE> action steps, finally followed by a Release Key Action <AMKEYUP> step.

Parameters

General Tab

Shift

Yes/No, Optional Default NO
MARKUP: SHIFT="YES"

Specifies that the SHIFT key should be held down for all steps following in the task in the task until a similarly configured "Release Key" Action <AMKEYUP> step is encountered.

Ctrl

Yes/No, Optional Default NO
MARKUP: CTRL="YES"

Specifies that the CTRL key should be held down for all steps following in the task in the task until a similarly configured "Release Key" Action <AMKEYUP> step is encountered.

AltGr

Yes/No, Optional Default NO
MARKUP: ALTGR="YES"

Specifies that the ALTGR key (available on many international keyboard layouts) should be held down for all steps following in the task in the task until a similarly configured "Release Key" Action <AMKEYUP> step is encountered.

Alt

Yes/No, Optional Default NO
MARKUP: ALT="YES"

Specifies that the ALT key should be held down for all steps following in the task in the task until a similarly configured "Release Key" Action <AMKEYUP> step is encountered.

Winkey

Yes/No, Optional Default NO
MARKUP: WINKEY="YES"

Specifies that the WINKEY key (the key with the Microsoft Windows logo on it) should be held down for all steps following in the task in the task until a similarly configured "Release Key" Action <AMKEYUP> step is encountered.

Notes

Include a Release Key Step in the Same Task

Not including a matching "Release Key Action <AMKEYUP> step will result in the special key being held down for the rest of the Windows session causing strange results when clicking or typing.

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMKEYDOWN SHIFT="YES">

<AMKEYDOWN SHIFT="YES" CTRL="YES" ALTGR="YES">