Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Send keys once

$
0
0

Hey everyone. I'm working on a simple scene switcher for OBS (Open Broadcaster Software) for my stream. In general it works, but in my opinion it works too much.

Here's my Code:

AutoIt         
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Scene Switcher ", 238, 69, 452, 309) $Label1 = GUICtrlCreateLabel("BF3,  SS3, RE6, ", 8, 40, 85, 17) $Active = GUICtrlCreateCheckbox("Active", 184, 40, 49, 17) $Label2 = GUICtrlCreateLabel("Scene 1=F10, 2=F11, 3=F12", 8, 8, 229, 18) GUICtrlSetFont(-1, 10, 400, 0, "OCR A Std") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit EndSwitch If GUICtrlRead($Active) = 1 Then     If ProcessExists("bf3.exe") Or ProcessExists("BH6.exe") Or ProcessExists("Sam3.exe") Or ProcessExists("BLR.exe") Then         Send("{F10 DOWN}")         Sleep(100)         Send("{F10 UP}")     Else         Send ("{F11 DOWN}")         Sleep(100)         Send("{F11 UP}")     EndIf EndIf WEnd

F10 and F11 are hotkeys for my 2 main scenes.

 

Now when none of these processes exist it keeps spamming f11, is there a way to prevent it from spamming it? It is supposed to send it once, but google can't give me an answer on that.

 

Thanks for reading, I hope you can help me.

 

PS: Can i just ad a super long sleep after SEND F11 UP? Or would that block the whole script from working?


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>