Key shortcuts

Modified on Mon, 5 Oct at 1:55 PM

It is possible to add shortcut keys to your module. Notice that it is very important to test and make sure that the compounded keys do not represent an existing shortcut key.

To create a shortcut, add a parameter to your button called key where you define the different keys separated with comma, e.g. if you create a shortcut key with Control+SHIFT+L, it should look like this:

key="Control, Shift, L"

Key values must be in enum values found on this list.

If you have trouble finding correct enum value, use programme that will show which key you click found here:

\...\OmniFiles\Misc\KeyClicked

Keep in mind that Button Special do not support shortcut keys as they are a collection of buttons corresponding to the amount of templates in \Content.

Examples

An example can be seen below. This button inserts placeholder text to be filled out by user at a later stage. Key shortcut is Control+Shift+B:

XML
<Button label="Insert fill" key="Control, Shift, B">
   <Cmd case="BaseExtensions:content-create" type="content-control" ContentControlType="RichText" title="" tag="" text="[*]" removeOnEdit="true" PlaceCursorOutside="true" Color="yellow"/>
</Button>

The latest version of Alloy enables to use the same key twice in a shortcut. In such case, define the shortcut twice separated by a +, like this:

key="Alt, A + Alt, A"

Sometimes, using the Alt key in shortcuts will result in Office interpreting the Alt key being pushed separately after module is executed. In these instances, it may be beneficial to include the following command in the end of your module:

XML
 <Cmd case="BaseExtensions:send-key" key="{ESC}"/>

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article