I wrote a very simple script attempting to send the key strokes.
Code: Select all
Loop {
Sleep, 60000
Send, {F11}
Sleep, 60000
Send, {F12}
}
Thank you for your help!
Code: Select all
Loop {
Sleep, 60000
Send, {F11}
Sleep, 60000
Send, {F12}
}
Code: Select all
loop {
sleep 60000
controlSend,,{F11},ahk_class Qt5QWindowIcon ; This class name is for OBS Studio. If you're using the other version, you can get the class name with AU3_Spy, application included with AHK.
sleep 60000
controlSend,,{F12},ahk_class Qt5QWindowIcon
}
Code: Select all
#o::
controlSend,, ^!{Numpad3},ahk_class Qt5QWindowIcon
return
Code: Select all
$#o::
send {lwin up}{rwin up}
controlSend,, ^!{Numpad3},ahk_class Qt5QWindowIcon
return
Code: Select all
!6::
{
controlSend,,^!{Numpad3}, ahk_class Qt5QWindowIcon
return
}
Code: Select all
#o::
{
controlSend,,^!{Numpad3}, ahk_class Qt5QWindowIcon
controlSend,,^!{Numpad3}, ahk_class Qt5QWindowIcon
controlSend,,^!{Numpad3}, ahk_class Qt5QWindowIcon
return
}
Code: Select all
^!6::
{
controlSend,,^!{Numpad3}, ahk_class Qt5QWindowIcon
return
}
Code: Select all
#MenuMaskKey vk07 ;Takes the extra CTRL event out of Alt+ hotkeys.
SetKeyDelay, -1, 50 ;Simulates holding down the key for 50ms.
*!Numpad4::ControlSend, , !{Numpad4}, ahk_class Qt5QWindowIcon ;Sends Alt+Numpad4 when... alt+numpad4 is pressed. I have my reasons!
I notice that these examples use the ahk_class Qt5QWindowIcon method of identifying the OBS window.Adabriel wrote: ↑14 Jun 2019, 20:05Nvm figured out the error:
Loop,
{
ControlSend,,{F5},ahk_class Qt5QWindowIcon
Sleep 5000
ControlSend,,{F6},ahk_class Qt5QWindowIcon
Sleep 5000
ControlSend,,{F7},ahk_class Qt5QWindowIcon
Sleep 5000
}
Break::
Pause,Toggle
Return
It must've been the way I didn't set the comma after 'Loop', hope this helps
Code: Select all
;Previously
global OBSHWND := GetOBS()
GetOBS() {
ntmm := A_TitleMatchMode
SetTitleMatchMode, Regex
;use the main window title to get the ID of the main window, because that's were we want the hotkeys to go
OBSHWND := WinExist("OBS .*[0-9]{2}\.[0-9]+\.[0-9]+ ahk_exe obs64.exe")
SetTitleMatchMode, %ntmm% ;avoids complicating other title matches
Return OBSHWND
}
SendKeyOBS(Key) {
tDelay := 250 ;ms
If OBSHWND {
If (WinExist("ahk_id " . OBSHWND)) { ;set's last found window
SetKeyDelay, 50,80 ;I experimented with various values here
;send key to last found window
ControlSend,ahk_parent,%key%
ErrLvl := ErrorLevel
If ErrLvl
;if you aren't using dbgview for script debugging consider it -- it is extremely useful (and free)
OutputDebug % Format("[{}][{}] ErrLvl: {}",sScript,A_ThisFunc . "." . A_LineNumber, ErrLvl) . " "
Sleep %tDelay% ;can't remember why this is here
}
OutputDebug % Format("[{}][{}] Key: {}; Err: {}; OBSHWND: {}",sScript,A_ThisFunc . "." . A_LineNumber,Key,ErrLvl,OBSHWND) . " "
}
Return ;no value returned
}