Jump to content
Sign in to follow this  
Chinasmoker

about press key

Recommended Posts

Hello ,every one ,I 'm a fan of autoit in China,and I was writing a script these days, some problems have arisen,

This script is used for game,It simulates pressing key,so if I wanna press A (letter) all the time in the game , The code ,How to effectuate?

eg.

-------------------------------------

run ("notepad.exe")

winwaitactive("NoTitle - note")

Send ("{a down}")

---------------------------------------

test result: The notepad just appeared a "A' , I almost fall in a faint..... :)


One is never too old to learn

Share this post


Link to post
Share on other sites

Hello ,every one ,I 'm a fan of autoit in China,and I was writing a script these days, some problems have arisen,

This script is used for game,It simulates pressing key,so if I wanna press A (letter) all the time in the game , The code ,How to effectuate?

eg.

-------------------------------------

run ("notepad.exe")

winwaitactive("NoTitle - note")

Send ("{a down}")

---------------------------------------

test result: The notepad just appeared a "A' , I almost fall in a faint..... :)

how must the program press for you?

like: constantly A or holding the A down for the WHOLE game?

$title = "title of your game"
WinActivate($title)
WinSetOnTop($title)

$x=0
do
 Send("A", 1);;just the A-key, if you write {down} it will send the DOWNARROW key
until $x=29

in this code, it makes an infinity loop and constantly presses the A button.

--------

Edit:

wait, hmm, strange, your code is correct...

$title = "title of the game"
WinActivate($title)
WinSetOnTop($title)

send("{A DOWN}", 0)

i think that will work, just try,

p.s im chinese to ^^

- me

Edited by Immense

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...