lucario Posted March 9, 2009 Share Posted March 9, 2009 Hi, i have this script, all it does is: Click a certain area on screen the move to another area and click multiple times. ive tried using HotKeySet but cant seem to get it to work. I want it so it clicks, moves, clicks the multiple times, but have a hotkey to stop the clicking then another one to start the clicking again. anyone help??? Thanks HotKeySet("+!d", "End") MouseClick("left", 915, 161, 1); MouseClick( "left", 738, 186, 300, 100); Func End() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Authenticity Posted March 9, 2009 Share Posted March 9, 2009 What's not working? the script that terminating immediately or the function "End". Anyway, as I see, it's the you don't have any loop to hold this program running, example: While 1 MouseClick("left", 915, 161, 1); MouseClick( "left", 738, 186, 300, 100); Sleep(50) ; To not spike your processor. WEnd Link to comment Share on other sites More sharing options...
lucario Posted March 9, 2009 Author Share Posted March 9, 2009 it runs the clicks but when i use the hotkeys, they dont pause the script. and i probally need something to start the script once its paused. Link to comment Share on other sites More sharing options...
Authenticity Posted March 9, 2009 Share Posted March 9, 2009 You need a flag to "stop" or "resume" the script execution of these 3 line of code of the earlier loop: HotKeySet("+!d", "End") Dim $fStop = False . . . Func End() $fStop = Not $fStop While $fStop Sleep(20) ; A good habit. WEnd EndFunc The first time this function is entered the $fStop variable is set to true so it'll start loop and do nothing but sleep. The next time this function is entered $fStop is set again to False and so this loop won't get executed (same for the earlier loop that have started). Link to comment Share on other sites More sharing options...
lucario Posted March 9, 2009 Author Share Posted March 9, 2009 Still cant seem to get it working. here is what i have: HotKeySet("+!d", "End") HotKeySet("+!g", "Go") Dim $fStop = False Func End() $fStop = Not $fStop While $fStop Sleep(20); A good habit. WEnd EndFunc Func Go() While 1 MouseMove(917,161,1); MouseClick("left"); MouseMove(738,186,1); MouseClick( "left",738,186,300); Sleep(300); To not spike your processor. WEnd EndFunc Link to comment Share on other sites More sharing options...
lucario Posted March 9, 2009 Author Share Posted March 9, 2009 the hotkeys still arent working ( Link to comment Share on other sites More sharing options...
lucario Posted March 9, 2009 Author Share Posted March 9, 2009 if it helps, you could change the hotkeys to something more suitable Link to comment Share on other sites More sharing options...
Authenticity Posted March 9, 2009 Share Posted March 9, 2009 ; O.K. HotKeySet("+!d", "End") HotKeySet("+!g", "Go") HotKeySet("{ESC}", "_EXIT") Dim $fStop = False Go() Func End() $fStop = Not $fStop ToolTip('"Not running"', 0, 0) While $fStop Sleep(20) WEnd ToolTip('"Running"', 0, 0) EndFunc Func Go() ToolTip('"Running"', 0, 0) While 1 ;MouseMove(917,161,1) ;MouseClick("left") ;MouseMove(738,186,1) ;MouseClick( "left",738,186,300) Sleep(30) WEnd EndFunc Func _EXIT() Exit EndFunc It's ok, it'll get better as time passes. ;] Link to comment Share on other sites More sharing options...
SpookMeister Posted March 9, 2009 Share Posted March 9, 2009 HotKeySet("{F6}", "Toggle") $i_toggle = 0 While 1 Sleep(100) ; always a good idea so you dont max your cpu While $i_toggle ToolTip("Running") WEnd ToolTip("") WEnd Func Toggle() $i_toggle = Not $i_toggle EndFunc ;==> [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
lucario Posted March 9, 2009 Author Share Posted March 9, 2009 The hotkeys are working. I know this because the Tooltip changes when i push them. but now the clicks wont work when you hit "Shift+Alt+G". So there seems to be a problem there. any ideas? Link to comment Share on other sites More sharing options...
Authenticity Posted March 9, 2009 Share Posted March 9, 2009 Three hundreds clicks on the same spot, mm... interesting. So what you believe is not working? the move part? the clicks? Link to comment Share on other sites More sharing options...
lucario Posted March 9, 2009 Author Share Posted March 9, 2009 I dont know what i did, but its actually working :-s Link to comment Share on other sites More sharing options...
lucario Posted March 9, 2009 Author Share Posted March 9, 2009 Thanks the help guys ^^ 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