AutoIt SendKey

http://www.codeproject.com/KB/cpp/sendkeys_cpp_Article.aspx

 

The following table is a slightly modified version of the MSDN/SendKeys help:

Key

Code

BACKSPACE

{BACKSPACE}, {BS}, or {BKSP}

BREAK

{BREAK}

CAPS LOCK

{CAPSLOCK}

DEL or DELETE

{DELETE} or {DEL}

DOWN ARROW

{DOWN}

END

{END}

ENTER

{ENTER} or ~

ESC

{ESC}

HELP

{HELP}

HOME

{HOME}

INS or INSERT

{INS}

LEFT ARROW

{LEFT}

NUM LOCK

{NUMLOCK}

PAGE DOWN

{PGDN}

PAGE UP

{PGUP}

PRINT SCREEN

{PRINTSCREEN}

RIGHT ARROW

{RIGHT}

SCROLL LOCK

{SCROLL}

TAB

{TAB}

UP ARROW

{UP}

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}

Keypad add

{ADD}

Keypad subtract

{SUBTRACT}

Keypad multiply

{MULTIPLY}

Keypad divide

{DIVIDE}

(table 1.a)

The following are my additions:

Key

Code

+

{PLUS}

@

{AT}

APPS

{APPS}

^

{CARET}

~

{TILDE}

{ }

{LEFTBRACE} {RIGHTBRACE}

( )

{LEFTPAREN} {RIGHTPAREN}

Left/Right WINKEY

{LWIN} {RWIN}

WINKEY

{WIN} equivalent to {LWIN}

(table 1.b)

In addition to this, I have added some special keys that act like commands:

Command Syntax

Action

{VKEY X}

Sends the VKEY of value X.

Very useful if you don't want to recompile CSendKeys and add new Vkey to the hardcoded special keys table.

For example, {VKEY 13} is equivalent to VK_RETURN.

{BEEP X Y}}

Beeps with a frequency of X and a duration of Y milliseconds.

{DELAY X}

Delays sending the next key of X milliseconds. After the delaying the following key, the subsequent keys will not be further delayed unless there is a default delay value (see DELAY=X).

Example: {DELAY 1000} <-- delays subsequent key stroke for 1 second.

{DELAY=X}

Sets the default delay value to X milliseconds. This will cause every key to be delayed X ms.

If a value is already set and you specify {DELAY Y} you will have your following key delay Y ms but the subsequent keys will be delayed X ms.

Example: {DELAY=1000} <-- all subsequent keys will be delayed for 1 second.

{APPACTIVATE WindowTitle}

Activates an application using is WindowTitle.

Very useful if you want to send different keys to different applications.

(table 2)

Key

Code

WINKEY

@

SHIFT

+

CTRL

^

ALT

%

(table 3)

Here are some examples:

Keystrokes

Description

{DELAY=50}@rnotepad~hello world%ha

  1. set delay after each character to 50 ms
  2. WINKEY+R to invoke the run dialog
  3. type "notepad" and press ENTER
  4. Type "hello world"
  5. Invoke Alt+H then press "A" to invoke the about dialog of notepad

{delay=100}{appactivate Calculator}{ESC}5*7~{beep 1000 500}^c{appactivate Notepad}^a{DEL}Result of 5*7 is: ^v

Given that "Calc.exe" and "Notepad.exe" are running:

  1. set delay to 100 ms
  2. activate calculatr
  3. press ESC to clear previous result
  4. type in 5*7 then press ENTER
  5. beep for 500ms with a frequency of 1000
  6. press CTRL+C to copy result
  7. activate notepad
  8. press CTRL+A then DEL in notepad to delete previously written text
  9. type in a phrase then press CTRL+V to paste the copied result

{DELAY=500}{NUMLOCK}{CAPSLOCK}{SCROLL}{SCROLL}{CAPSLOCK}{NUMLOCK}

  1. Press NUM,CAPS,SCROll lock in order
  2. Turn them off in reverse order

{DELAY=500}% {DOWN 5}

  1. press ALT+SPACE
  2. press DOWN key 5 times

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值