alfa Posted September 16, 2014 Share Posted September 16, 2014 Hi, I am trying to make autoit press different keys with different hotkeys. With this scripts that i made with my limited knowledge it stops the previous key from being send. I want them both being pressed. Thanks in advance to point out my mistakes Global $UnPaused1 Global $UnPaused2 HotKeySet("{F1}", "TogglePause1") HotKeySet("{F2}", "TogglePause2") HotKeySet( "{PGDN}", "Terminate" ) While 1 Sleep(100) ToolTip("Script is Paused",0,0) WEnd Func TogglePause1() $UnPaused1 = NOT $UnPaused1 While $UnPaused1 ;~ ToolTip("Sending...",0,0) Send("3") Sleep (150) WEnd EndFunc Func TogglePause2() $UnPaused2 = NOT $UnPaused2 While $UnPaused2 ;~ ToolTip("Sending...",0,0) Send("4") Sleep (100) WEnd EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
JohnOne Posted September 16, 2014 Share Posted September 16, 2014 Func TogglePause1() HotKeySet("{F1}") Send("{F1}") HotKeySet("{F1}", "TogglePause1") $UnPaused1 = NOT $UnPaused1 While $UnPaused1 ;~ ToolTip("Sending...",0,0) Send("3") Sleep (150) WEnd EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
alfa Posted September 16, 2014 Author Share Posted September 16, 2014 Func TogglePause1() HotKeySet("{F1}") Send("{F1}") HotKeySet("{F1}", "TogglePause1") $UnPaused1 = NOT $UnPaused1 While $UnPaused1 ;~ ToolTip("Sending...",0,0) Send("3") Sleep (150) WEnd EndFunc it didnt work Thanks anyway. Well this code worked but it still stoped the second key. Link to comment Share on other sites More sharing options...
j0kky Posted September 16, 2014 Share Posted September 16, 2014 (edited) I suggest you to set just the value of a variable with HotKeySet and left the work to main loop: [pseudocode] Global $var1, $var2 HotKeySet("{F1}", "TogglePause1") HotKeySet("{F2}", "TogglePause2") HotKeySet( "{PGDN}", "Terminate" ) While 1 Sleep(100) ToolTip("Script is Paused",0,0) If $var1 == value1 Then While something ;do things If $var2 == value2 Then Exitloop Wend EndIf If $var2 == value2 Then While something ;do things If $var1 == value1 Then Exitloop Wend EndIf WEnd Func TogglePause1() $var1 = value1 EndFunc Func TogglePause2() $var2 = value2 EndFunc Func Terminate() Exit 0 EndFunc Edited September 16, 2014 by j0kky Spoiler Some UDFs I created: Winsock UDF STUN UDF WinApi_GetAdaptersAddresses _WinApi_GetLogicalProcessorInformation Bitwise with 64 bit integers An useful collection of zipping file UDFs 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