DatOneGuy Posted February 1, 2011 Share Posted February 1, 2011 I'm trying to convert the following from AutoHotKey to AutoIt and can't figure out any equal to settimer, searching led me to AdLibEnable(), but I'm not sure it'll work as I want it to. Basically I just want to be able to click the hotkey whenever I wish and turn the script on or off from continuously repeating. IsStart := 1 SetTimer, Click, 4000 SetTimer, Click, Off Hotkey, !^z, ControlTimer Return ControlTimer: If IsStart = 1 { SetTimer, Click, On IsStart := 0 } Else { SetTimer, Click, Off IsStart := 1 } Return Click: Click 548,895 Return Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 1, 2011 Moderators Share Posted February 1, 2011 DatOneGuy,May I suggest reading the Interrupting a running function tutorial in the Wiki? It suggests several ways to do what you want. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
DatOneGuy Posted February 1, 2011 Author Share Posted February 1, 2011 I'll just have to do it manually I guess, I don't understand that article too much, how do I do it without having to use aGUI? I just want to press a hotkey, not use a UI. Thanks though, this'll work as is for me without having to add that anyway I suppose. Link to comment Share on other sites More sharing options...
AoRaToS Posted February 1, 2011 Share Posted February 1, 2011 I'll just have to do it manually I guess, I don't understand that article too much, how do I do it without having to use aGUI? I just want to press a hotkey, not use a UI.Thanks though, this'll work as is for me without having to add that anyway I suppose.so you use HotkeySet("key", "function")the hotkey will call the function when it's pressed and interrupt anything else running s!mpL3 LAN Messenger Current version 2.9.9.1 [04/07/2019] s!mpL3 LAN Messenger.zip s!mpL3 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 2, 2011 Share Posted February 2, 2011 (edited) @DatOneGuy Hi and Welcome to the forum! I doesn't sound like you want a timer, it sounds like you want the example for HotKeySet(), see helpfile Edited February 2, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
jvanegmond Posted February 2, 2011 Share Posted February 2, 2011 (edited) Yes, you should use AdlibEnable AdlibRegister as the AutoIt equivalent to SetTimer.$IsStart = 1 ;IsStart := 1 ;SetTimer, Click, 4000 ;SetTimer, Click, Off HotKeySet("!^z", "ControlTimer") ;Hotkey, !^z, ControlTimer Exit ;Return Func ControlTimer();ControlTimer: If $IsStart = 1 Then;If IsStart = 1 ;{ AdlibRegister("Click", 4000) ;SetTimer, Click, On $IsStart = 0; IsStart := 0 ;} Else ;{ AdlibUnRegister("Click") ;SetTimer, Click, Off $IsStart = 0;IsStart := 1 ;} EndIf EndFunc Func Click();Click: MouseClick(548, 895); Click 548,895 EndFunc ;Return Edited February 2, 2011 by Manadar github.com/jvanegmond 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