Jump to content

Problem with Alt + key


Recommended Posts

Well heres my code, and thanks to all the people who got me this far.

What I want this to do is click, press alt+q, click, repeat

The clicks work perfectly fine, but the alt+q only works like 30% of the time. Is there a way to make it 100% accurate?

If you have any ideas post the code so I can try them out thanks.

HotKeySet("{f10}", "_exit") ;<== F10 to exit

while 1

MouseClick ( "left",30,328)

Sleep(1500) ;<== 1000 is 1 sec, so 5000 is 5 sec of waiting

Send("{Alt down}")

Send("{q}")

Send("{Alt up}")

sleep(500)

MouseClick ( "left",790,328)

Sleep(1500) ;<== 1000 is 1 sec, so 5000 is 5 sec of waiting

Send("{Alt down}")

Send("{q}")

Send("{Alt up}")

sleep(500)

WEnd

Func _exit()

Exit

EndFunc

Link to comment
Share on other sites

I have no way to test this, but perhaps in the time that you're waiting between keyboard shortcuts, the game or window isn't active? It sounds like the game isn't receiving the command. Maybe a WinActivate and WinWaitActive command between keyboard/mouse commands would help. (Just throwing out ideas to try.)

Edited by GMK
Link to comment
Share on other sites

i think what it needs to do is hold alt down for 2 seconds, and during that time press q. I cant use the sleep though because it makes the whole program sleep, which doesnt make the games reaction time between buttons change.

So if theres a way to make alt get held down for a length of time without sleeping the entire program than w/e that way is should work.

If u know how to do the above then post the code, thanks.

Link to comment
Share on other sites

i think what it needs to do is hold alt down for 2 seconds, and during that time press q. I cant use the sleep though because it makes the whole program sleep, which doesnt make the games reaction time between buttons change.

So if theres a way to make alt get held down for a length of time without sleeping the entire program than w/e that way is should work.

If u know how to do the above then post the code, thanks.

Give the following a try. The higher the number the longer the delay. The Help file will explain these in more detail. When I had issues with send keys and/or mouseclicks not working consistently adjusting the two values fixed the problem.

Opt("MouseClickDownDelay", 200)
Opt("SendKeyDelay", 200)
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...