pasqui Posted May 1, 2017 Share Posted May 1, 2017 Hi all, Can you please help me with a simple script? It's for click automatically a button every 1 hour. I have this code: HotKeySet("+s", "Start") HotKeySet("{x}", "_Exit") While 1 sleep(1000) mouseClick("left",326,346,1) sleep(60 * 60 * 1000) WEnd Func _Exit() Exit EndFunc I would like decide when start and when stop the script (on my Tablet with Windows 10), but Shift+s ("+s" code) doesn't work to me. Exit with "x" key only, instead, works. When I click on "Run Script", script runs instantly, but I want choose when, pressing Shif+s. Thank you in advance Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 1, 2017 Moderators Share Posted May 1, 2017 @pasqui what are you trying to accomplish? There are bound to be better ways of doing it than with constant mouseclicks. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Floops Posted May 2, 2017 Share Posted May 2, 2017 How about this? Global $bStart = False HotKeySet("+s", "_Start") HotKeySet("{x}", "_Exit") While 1 Sleep(1000) If $bStart Then MouseClick("left",326,346,1) Sleep(60 * 60 * 1000) EndIf WEnd Func _Start() $bStart = True EndFunc Func _Exit() Exit EndFunc Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted May 2, 2017 Share Posted May 2, 2017 Rather than the long sleep period where the script will be non responsive. I think a timer or adlibregister is a better way to go. HotKeySet("+s", "_Start") HotKeySet("{x}", "_End") HotKeySet("{ESC}", "_Exit") While 1 Sleep(10) WEnd Func _Start() AdlibRegister("_Click", 60*60*1000) EndFunc Func _End() AdlibUnRegister("_Click") EndFunc Func _Click() MouseClick("Left", 326, 346, 1) EndFunc Func _Exit() Exit EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now