I am working on a macro to interact with an online game. It needs short delays between clicks etc. I have got the macro working, using
System.Threading.Thread.Sleep(200)
and so forth...
However I need a way to stop this macro running at any point, using a hotkey. Perhaps there is a better way to do this also, but I have used
And when (F8 I have used) is pressed, the loop ends.
The problem is that by using system.threading.thread.sleep, the whole application is effectively paused, and so the timer on which the GetAsyncKeyState function is running, cannot check for a keypress. When the macro is not running, it reads the key perfectly.
Is there any way of putting a delay in without pausing the whole application, or another way i might be able to stop the macro running?*
*I have a button on the application, and it is set to alwaysontop, however becuase the macro is clicking up to 7 times per second, i cannot give the application focus.
Thankyou in advance
System.Threading.Thread.Sleep(200)
PHP:
While x < repeats
SetCursorPos(xbase + 255, ybase + 167)
System.Threading.Thread.Sleep(200)
rightclick()
System.Threading.Thread.Sleep(200)
However I need a way to stop this macro running at any point, using a hotkey. Perhaps there is a better way to do this also, but I have used
PHP:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Integer
The problem is that by using system.threading.thread.sleep, the whole application is effectively paused, and so the timer on which the GetAsyncKeyState function is running, cannot check for a keypress. When the macro is not running, it reads the key perfectly.
Is there any way of putting a delay in without pausing the whole application, or another way i might be able to stop the macro running?*
*I have a button on the application, and it is set to alwaysontop, however becuase the macro is clicking up to 7 times per second, i cannot give the application focus.
Thankyou in advance