HankHell Posted January 31, 2018 Share Posted January 31, 2018 hey guys, not sure if this is something that well known. I asked a question a while back to see if I could use a single hotkey as a toggle between states or functions. After not getting any replies and the topic going dead, I figured I'd post this so that others can use single hotkeys as a toggle as well. #include <MsgBoxConstants.au3> HotKeySet("{ESC}", "End") HotKeySet("{F1}", "Toggle") Global $MOUSE_CLICK_LEFT Global $State = 1 Global $ToggleState Global $Toggle = True If $Toggle = False Then $ToggleState = True Else $ToggleState = False EndIf While $State = 1 Sleep(100) WEnd Func Toggle() $ToggleState = NOT $ToggleState While $ToggleState MouseClick($MOUSE_CLICK_LEFT) If Not $ToggleState Then MsgBox($MB_SYSTEMMODAL,"Notice","Macro Ended",10) EndIf WEnd Sleep(100) EndFunc Func End() Exit EndFunc and of course this also works as well... Func Toggle() $ToggleState = NOT $ToggleState If $ToggleState Then MsgBox($MB_SYSTEMMODAL,"Test 1","1",10) Else MsgBox($MB_SYSTEMMODAL,"Test 2","2",10) EndIf Sleep(100) EndFunc Link to comment Share on other sites More sharing options...
jdelaney Posted January 31, 2018 Share Posted January 31, 2018 Non-question posts fit in here https://www.autoitscript.com/forum/forum/9-autoit-example-scripts/ IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
HankHell Posted January 31, 2018 Author Share Posted January 31, 2018 3 hours ago, jdelaney said: Non-question posts fit in here https://www.autoitscript.com/forum/forum/9-autoit-example-scripts/ ah cool, sorry about that 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