OneTime! Posted September 5, 2006 Share Posted September 5, 2006 Hia folks First day here, trying to understand Auto-it and so far I think Im doing pretty well at it Created my first script and I'm having a lil bit of trouble actually topping the loop. I know it's super easy but it's 2am , I'm a lil tired and I would like your help/input. Meanwhile you answer my topic I will be busy trying to see if I can get it to stop myself (back to help/syntax files :"> ) Thank you and heres the code : While 1 HotKeySet("+!x", "terminate") WinActivate("SwgClient") Opt("MouseCoordMode", 2) MouseClick("Left", 622, 347, 2, 50) Opt("MouseClickDelay", 250) MouseClick("Left", 622, 347, 2, 50) Opt("MouseClickDelay", 250) MouseClick("Left", 622, 347, 2, 50) Opt("MouseClickDelay", 250) MouseClick("Left", 622, 347, 2, 50) Opt("MouseClickDelay", 250) WEnd Func terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
OneTime! Posted September 5, 2006 Author Share Posted September 5, 2006 coudl this be it ? forgot to use ControlSend() and/or Send() ?? When you set a hotkey, AutoIt captures the key-press and does not pass it on to the active application, with one exception: the Lock keys (NumLock, CapsLock, and ScrollLock) still toggle their respective state! To Send() a key combination which will trigger a HotKeySet() event, either use ControlSend() or unregister the HotKeySet() event, otherwise, the Send() event may trigger an infinite loop. ; capture and pass along a keypress HotKeySet("{Esc}", "captureEsc") Func captureEsc() ; ... can do stuff here HotKeySet("{Esc}") Send("{Esc}") HotKeySet("{Esc}", "captureEsc") EndFunc P.S. Did I mention it's my first time using AutoIt ? :"> Link to comment Share on other sites More sharing options...
lod3n Posted September 5, 2006 Share Posted September 5, 2006 try this:if not HotKeySet("+!x", "terminate") then exit that'll make the script quit if hotkeyset isn't working, so you can try other hotkey combos until you find one that works. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Helge Posted September 5, 2006 Share Posted September 5, 2006 I'm confused in what exactly you're trying to do, so can you explain step by step what you want your script to do ? Also, it might help if you mention what application you are trying to work with.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 5, 2006 Moderators Share Posted September 5, 2006 (edited) In your function, you can kill it and reacivate it. HotKeySet('s', 'Sends') While 1 Sleep(1000) WEnd Func Sends() HotKeySet('s', '');kill it Send('s') ;Do Something HotKeySet('s', 'Sends');reactivate it EndFunc Edited September 5, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
lod3n Posted September 5, 2006 Share Posted September 5, 2006 I don't know what you're trying to do either, but I think you ought to replace those "Opt("MouseClickDelay", 250)"s with "sleep(250)". Besides, the Opt command only needs to be run once, at the top of the script. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 5, 2006 Moderators Share Posted September 5, 2006 LOL, well I took the fact that he mentioned an endless loop, and he doesn't have a loop in what he showed, that he is using Send('s') in the HotKeySet('s'), so it keeps repeating itself over and over. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
OneTime! Posted September 5, 2006 Author Share Posted September 5, 2006 I'm confused in what exactly you're trying to do, so can you explain step by step whatyou want your script to do ? Also, it might help if you mention what application you aretrying to work with..Just trying to get the hang of it and because I have a game client open, I decided to try a simple mouseclik script to go with it. Basically I want it to find the Game window, check if its active, and if so run the script (which basically double cliks endlessly till I stop it).If game window is not active, its supposed to do nothing (working on that line in the code as we speak) Link to comment Share on other sites More sharing options...
OneTime! Posted September 5, 2006 Author Share Posted September 5, 2006 In your function, you can kill it and reacivate it. HotKeySet('s', 'Sends') While 1 Sleep(1000) WEnd Func Sends() HotKeySet('s', '');kill it Send('s') ;Do Something HotKeySet('s', 'Sends');reactivate it EndFunc Ok so with this added to my code , will "s" activate it and stop it whenever I want it correct ? In the client window ? If so I will go tweak it right now and see what happens. Link to comment Share on other sites More sharing options...
OneTime! Posted September 5, 2006 Author Share Posted September 5, 2006 LOL, well I took the fact that he mentioned an endless loop, and he doesn't have a loop in what he showed, that he is using Send('s') in the HotKeySet('s'), so it keeps repeating itself over and over.The loop is working, and the problem IS that its endless. I will go modify the script based on the new imput and see if I can control it (aka stop it/turn it on ) and post back. Link to comment Share on other sites More sharing options...
OneTime! Posted September 6, 2006 Author Share Posted September 6, 2006 Ok the problem I have is stopping it in the client itself. I can stop, reactivate in windows, but not within the client. Any suggestions ? Link to comment Share on other sites More sharing options...
OneTime! Posted September 6, 2006 Author Share Posted September 6, 2006 Ok , I've been playing with WinClose and WinShow, is there a way to leave the script running ONLY in the window specified ? Say if I want to run two separate scripts in two different windows.... ? Link to comment Share on other sites More sharing options...
Paulie Posted September 6, 2006 Share Posted September 6, 2006 Ok , I've been playing with WinClose and WinShow, is there a way to leave the script running ONLY in the window specified ? Say if I want to run two separate scripts in two different windows.... ?Try the control functionsControlClick()ControlSend() 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