Jump to content
Sign in to follow this  
JoeN

Simple Question

Recommended Posts

JoeN

While 1
WEnd


HotKeySet("{c}", "Thrust")

Func Thrust()
    Send("{W 2}")
MouseClick ("left")
EndFunc

This script is supposed to press W two times and then left click whenever the C key is pressed, until the program is shut down. For some reason this simple thing is not working. Perhaps someone can lend me a minute of help.

Share this post


Link to post
Share on other sites
MHz

Registering the HorKey 1st may help and a sleep in the loop is a good thing for your CPU. Try this:

HotKeySet("c", "Thrust")

While 1
    Sleep(500)
WEnd

Func Thrust()
    Send("{W 2}")
    MouseClick ("left")
EndFunc

Share this post


Link to post
Share on other sites
Jos

While 1
WEnd
HotKeySet("{c}", "Thrust")

Func Thrust()
    Send("{W 2}")
MouseClick ("left")
EndFunc

This script is supposed to press W two times and then left click whenever the C key is pressed, until the program is shut down. For some reason this simple thing is not working. Perhaps someone can lend me a minute of help.

Do you think that AutoIt3 ever runs the statement that activates you HotKet ?

You need to put that before you While..Wend loop....


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
JoeN

HotKeySet("{C}", "Thrust")
While 1
    Sleep(100)
WEnd

Func Thrust()
    Send("{W 2}")
MouseClick ("left")
EndFunc

Still no dice :lmao:

Share this post


Link to post
Share on other sites
JoeN

I always have the most stupid errors :lmao: Many thanks.

Edited by JoeN

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  

×