Advanced SendKeys Method of Pasting

Top  Previous  Next

This new functionality is available as of v1.20.01 and is provided by the TPushKeys component by Alan Warriner which encapsulates, and extends, Christopher Latta's PushKeys code ([email protected], www.alan-warriner.co.uk)

 


 

Normally CHS pastes text by putting it on the clipboard and then simulating a CTRL+V in the target window.  This works fine in 99% of cases.

 

But now if a clip starts with {sendkeys} then CHS will use an alternative method of pasting the clip into the target application (or you can set it to use the alternate method by default).

 

The new method simulates each key press one at a time, and most importantly, can send tabs, function keys, ctrl keys, etc.

 

This will let you create clips that actually fill out multiple fields by putting a TAB after each field.

 


 

And a really cool example of this is that you can create a Formatting Preset for example, that takes a string like 1111-2222-3333 and converts it to:

{sendkeys}1111{TAB}2222{TAB}3333

 

If you call this formatting preset something like "Paste Serial Into Fields" you can see why it would be useful -- you can use it to fill in a multi-field serial number dialog in an installation program using only a couple of key presses:

 

   * Select the string with dashes in it

   * Move to the first serial number field in the installer

   * Hit Ctrl+Alt+Q to bring up the quick paste menu (or whatever hotkey you configured), and choose the "Paste Serial Into Fields" preset from the menu.

   * All done.

 


 

Special strings that you can use in a {sendkeys} clip, from the TPushKeys help file:

 

Function key definitions are enclosed within braces, keys from F1 to F24 are represented by:

 

{F1}...{F24}

 

State Modifiers

 

Shift Key                +

Ctrl Key                        ^

Left Alt Key                %

Right Alt Key (Alt Gr)        !

 

Prefix any key definition with the appropriate modifier to affect the key press immediately following it e.g. +ab will result in the key strokes Ab being directed to the application.

 

To extend the modifier to affect a group of characters enclose them in parentheses e.g  !(ab) will result in AB being simulated. Parentheses may be nested so that !(+(ao)) will give ÁÓ.

 

Note: State Modifiers need not be used with standard keys as they can be entered directly. See example

 

IMPORTANT: When you want to trigger normal letter keys in combination with Ctrl Alt Shift, you *MUST* use lowercase versions of the letters, or a SHIFT key will be simulated.

 

To simulate the press and release of a modifier key then the key symbol must be the only character in the Keys string. See example

 

Numeric Keypad

 

Numeric keypad keys are enclosed within braces.

 

0 to 9                {NUMPAD0}...{NUMPAD9}

-                {NUMPAD-} or {NUMPADSUBTRACT}

+                {NUMPAD+} or {NUMPADADD}

/                {NUMPAD/} or {NUMPADDIVIDE}

 

*                {NUMPAD*} or {NUMPADMULTIPLY}

.                {NUMPAD.} or {NUMPADDECIMAL}

 

Navigation Keys

 

Navigation keys are enclosed within braces.

 

Enter                        {ENTER} or {RETURN} or ~

Newline                        {NL} or {NEWLINE}

Cursor Down                {DOWN}

Cursor Up                {UP}

Cursor Left                {LEFT}

Cursor Right                {RIGHT}

Page Up                {PGUP} or {PAGEUP} or {PRIOR}

Page Down                {PGDN} or {PAGEDOWN} or {NEXT}

Delete                        {DEL} or {DELETE}

Backspace                {BS} or {BKSP} or {BACKSPACE}

Home                        {HOME}

 

End                        {END}

Tab                        {TAB}

Formfeed                {FF}

 

Delay

 

A delay may be introduced into the key stream by using:

 

{SLEEP n}

 

where n is a numeric value representing a number of milli-seconds to wait. Note: the KeyDelay pause is ignored following a {SLEEP} key.  See example

 

Direct Entry

 

A key code may be entered directly in the form:

 

{\nnnn}

 

where nnnn represents the Alt-Numeric keypad keys used to generate the character.

 

Note: Normally this option is not needed as characters may be entered directly into the Keys string. See example

 

Other Keys

 

This section includes the method to send reserved keys: !,%,^,+,~. See example

 

Bell                        {BELL}

Break                        {BREAK}

Caps lock                {CAPS} or {CAPSLOCK}

Escape                        {ESC} or {ESCAPE}

Help                        {HELP}

Insert                        {INS} or {INSERT}

Number lock                {NUMLOCK}

Printscreen                {PRINTSCREEN} or {PRTSC}

 

Scroll lock                {SCROLLLOCK} or {SCRLK}

Pause                        {PAUSE}

Cancel                        {CANCEL}

Left Windows key        {LEFTWIN} or {START}

Right Windows key        {RIGHTWIN}

Applications key        {APPS} or {CONTEXT}

Left brace                {{}

~                        {~}

+                        {+}

%                        {%}

^                        {^}

!                        {!}

 

 


 

This new functionality is provided by the TPushKeys component by Alan Warriner which encapsulates, and extends, Christopher Latta's PushKeys code ([email protected], www.alan-warriner.co.uk)