Sending Keystrokes
By default, DataLoad Macros use copy and paste to enter data into the target application, and on most occasions this is the best approach. Occasionally, however, it is desirable to be able to send keystrokes to the application. DataLoad allows you to send the entire keyboard's printing and most non-printing (E.g. the function keys) characters to the active window as if they were typed at the keyboard. To specify that a cell should result in key presses the text should be preceded with a backslash. For example, the following would result in each of the specified keys, except for '\', to be sent as simulated key presses.
\Send this as keystrokes
To send a cell which must start with a backslash using copy and paste, precede the cell text with a second backslash. For example, the following will cause "\Send this as keystrokes" to be pasted into the target application:
\\Send this as keystrokes
One or more characters represent each key. To specify a single keyboard character, use the character itself. For example, to send the letter A, use \A. To send multiple characters, append each additional character to the one preceding it. To send the letters A, B, and C, use \ABC. When DataLoad presses a specified key it automatically takes account of any other key which may need to be pressed to send the exact character which was specified. For instance, if a form. field is populated by using the command \A an 'A' will appear in the field, that is the character's case is preserved. In the example of uppercase characters the shift key is automatically depressed with the character key to send an uppercase letter.
To use any combination of the Shift, Control, Alt and right Alt keys one of the following codes should be used:
Key Code
SHIFT +
CTRL ^
ALT %
Right Alt &
Each of these codes toggles the key in question. Each of these keys is initially in the "up" position and when one of those codes are used the desired key is depressed. When the code is used again the key is lifted, and so on. If any keys are left depressed when the DataLoad cell has been processed the key is lifted. The following are examples:
Cell Contents Effect in Active Window
\%F% Alt-F
\%F Same as above
If you want to send the +, ^, % or & keys these characters must be enclosed in braces {}. For example, to send '2 +2=4' the following should be entered in the DataLoad cell:
\{2+2=4}
To send a key or a number of keys multiple times, use the following syntax:
\{key(s) number}
You must put a space between the key(s) and number. For example, {d 10} means press d 10 times, while {Data 5} sends the keys 'Data' 5 times. The non-printing characters described below can also be sent multiple times in this way.
To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent actions rather than characters, use the codes shown below. Note that these codes are also enclosed in braces.
Key Code
BACKSPACE {BACKSPACE}
DELETE {DELETE}
UP ARROW {UP}
DOWN ARROW {DOWN}
LEFT ARROW {LEFT}
RIGHT ARROW {RIGHT}
END {END}
ENTER {ENTER}
TAB {TAB}
ESC {ESC}
HOME {HOME}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
INSERT {INSERT}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
By default, DataLoad Macros use copy and paste to enter data into the target application, and on most occasions this is the best approach. Occasionally, however, it is desirable to be able to send keystrokes to the application. DataLoad allows you to send the entire keyboard's printing and most non-printing (E.g. the function keys) characters to the active window as if they were typed at the keyboard. To specify that a cell should result in key presses the text should be preceded with a backslash. For example, the following would result in each of the specified keys, except for '\', to be sent as simulated key presses.
\Send this as keystrokes
To send a cell which must start with a backslash using copy and paste, precede the cell text with a second backslash. For example, the following will cause "\Send this as keystrokes" to be pasted into the target application:
\\Send this as keystrokes
One or more characters represent each key. To specify a single keyboard character, use the character itself. For example, to send the letter A, use \A. To send multiple characters, append each additional character to the one preceding it. To send the letters A, B, and C, use \ABC. When DataLoad presses a specified key it automatically takes account of any other key which may need to be pressed to send the exact character which was specified. For instance, if a form. field is populated by using the command \A an 'A' will appear in the field, that is the character's case is preserved. In the example of uppercase characters the shift key is automatically depressed with the character key to send an uppercase letter.
To use any combination of the Shift, Control, Alt and right Alt keys one of the following codes should be used:
Key Code
SHIFT +
CTRL ^
ALT %
Right Alt &
Each of these codes toggles the key in question. Each of these keys is initially in the "up" position and when one of those codes are used the desired key is depressed. When the code is used again the key is lifted, and so on. If any keys are left depressed when the DataLoad cell has been processed the key is lifted. The following are examples:
Cell Contents Effect in Active Window
\%F% Alt-F
\%F Same as above
If you want to send the +, ^, % or & keys these characters must be enclosed in braces {}. For example, to send '2 +2=4' the following should be entered in the DataLoad cell:
\{2+2=4}
To send a key or a number of keys multiple times, use the following syntax:
\{key(s) number}
You must put a space between the key(s) and number. For example, {d 10} means press d 10 times, while {Data 5} sends the keys 'Data' 5 times. The non-printing characters described below can also be sent multiple times in this way.
To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent actions rather than characters, use the codes shown below. Note that these codes are also enclosed in braces.
Key Code
BACKSPACE {BACKSPACE}
DELETE {DELETE}
UP ARROW {UP}
DOWN ARROW {DOWN}
LEFT ARROW {LEFT}
RIGHT ARROW {RIGHT}
END {END}
ENTER {ENTER}
TAB {TAB}
ESC {ESC}
HOME {HOME}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
INSERT {INSERT}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21034083/viewspace-578418/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21034083/viewspace-578418/