PasteKeys Method

Action2 Example

 

Encapsulates the AutoMate™ action in the “General” group, “Paste Keys.” The method first copies the desired key sequence to the system clipboard, then pastes them to the focused window.

 

Declaration

function PasteKeys (varKeysToPaste As Variant) As Integer

 

Parameters

varKeysToPaste

 The keystrokes (or text) to be pasted to the focused application.

 

Description

The PasteKeys method first copies the text specified in varKeysToPaste to the system clipboard, then copies it to the currently focused window.

 

PasteKeys is faster than SendKeystrokes because it copies the contents from the system clipboard in one step, whereas SendKeystrokes emulates a user typing each key individually on the keyboard. The disadvantage to this is that PasteKeys does not support special keys (such as the arrow keys or HOME key). If you need to send anything other than straight text, use SendKeystrokes instead.