Jump to content

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

Link to comment
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
Link to comment
Share on other sites

I ve a question also

Has a script got some "while...end"?

such as : while 1

.....

.......

wend

while 1

.....

.......

wend

Thank you ,About first question of this topic ,I will test tomorrow,I am busy now ,at that time ,I will give test result to you ,Thanks!

One is never too old to learn

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...