vaca1 Posted May 5, 2019 Share Posted May 5, 2019 Hi , I have 2 scripts, test1.au3 and test2.au3, ;; test1.au3 HotKeySet("{F8}", "keypressf8") while(1) wend Func keypressf8() MsgBox(0,"", "AAAAAAAAAAAAA") EndFunc ;; test2.au3 HotKeySet("{F8}", "keypressf8") while(1) wend Func keypressf8() MsgBox(0,"", "BBBBBBBBBB") EndFunc I executed the two scripts at once, when I pressed F8, there is only one Msgbox "AAAAAAAAAA" , anyone knows how to let key F8 works for the two scripts at once? Thanks. Link to comment Share on other sites More sharing options...
mikell Posted May 5, 2019 Share Posted May 5, 2019 If two AutoIt scripts set the same hotkeys, you should avoid running those scripts simultaneously as the second script cannot capture the hotkey unless the first script terminates or unregisters the key prior to the second script setting the hotkey. If the scripts use GUIs, then consider using GUISetAccelerators as these keys are only active when the parent GUI is active. (help file) Link to comment Share on other sites More sharing options...
Network_Guy Posted May 5, 2019 Share Posted May 5, 2019 you can use _IsPressed(Hex_key) in that case , here is an example : - First Script #include <Misc.au3> $scriptname="test1.au3" while 1 $key=_IsPressed(77) ;f8 key if $key then keypressf8() EndIf Sleep(1) wend func keypressf8() MsgBox(0,"","AAAAAAAAAAAAAA") EndFunc Second Script #include <Misc.au3> $scriptname="test2.au3" while 1 $key=_IsPressed(77) ;f8 key if $key then keypressf8() EndIf Sleep(1) wend func keypressf8() MsgBox(0,"","BBBBBBBBBBBB") EndFunc Link to comment Share on other sites More sharing options...
vaca1 Posted May 6, 2019 Author Share Posted May 6, 2019 Thank you so much. You resolved my question. 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