Autohotkey & OBS issue

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Vader_666
Posts: 3
Joined: 30 Dec 2019, 14:13

Autohotkey & OBS issue

30 Dec 2019, 14:27

Hello,

I have an issue with sending keys to OBS Studio. I use the version 24.0.3 64bits of OBS Studio. I try to send a simple shortcut but I have no success and it drives me nuts!
I searched for solutions and tried several found within this forum but it still not work and I don't understand why. Here is my little script :

Code: Select all

#MenuMaskKey vk07  ;Takes the extra CTRL event out of Alt+ hotkeys.
SetKeyDelay, -1, 50  ;Simulates holding down the key for 50ms.
^=::
ControlSend, , {F12}, ahk_class Qt5QWindowIcon
return
Currently it's just for testing purpose, but as I press Ctrl+= it should send F12 to OBS (F12 is bind to the function "Preview mode"). But it doesn't work.
I put the 2 first lines as seen in another post (without success).

And the worst part is if I go in the parameters of OBS, in the screen to change the shortcuts, and if I hit Ctrl+= It put in the shortcut field F12 ! So it seems that the key is sent to OBS in some way, but it doesn't trigger the shortcut...
It works with Send, but I'd like to send the key to the window in the background and not put it in the foreground beforehand...

Did I miss something obvious here ?

Thank you in advance for your help.
MannyKSoSo
Posts: 440
Joined: 28 Apr 2018, 21:59

Re: Autohotkey & OBS issue

30 Dec 2019, 15:48

Are you sure ahk_class Qt5QWindowIcon is correct for OBS? It looks like it is trying to open up the Qt5 editor which is for C++ gui's. Double check with window spy to make sure you have the correct ahk_class, then it may work. Otherwise I don't see anything wrong with this code.
Vader_666
Posts: 3
Joined: 30 Dec 2019, 14:13

Re: Autohotkey & OBS issue

30 Dec 2019, 16:35

Thank you for your answer MannyKSoSo. Yes I'm sure of the class (check following screenshot : i.imgur.com/shaIpb2.png)

I also tried with the window title, the exe, id and pid (I'm aware those last two are changing, I was fetching them within the script dynamically) but without success.
It's a mystery for me. It's like with controlsend, obs isn't using the key... :(
MannyKSoSo
Posts: 440
Joined: 28 Apr 2018, 21:59

Re: Autohotkey & OBS issue

30 Dec 2019, 18:44

I double checked on my version (guess it was written in C++ with Qt, never knew). but I was able to get the following working.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MenuMaskKey vk07  ;Takes the extra CTRL event out of Alt+ hotkeys.
SetKeyDelay, -1, 50  ;Simulates holding down the key for 50ms.
^=::
ControlSend, , {F12}, ahk_exe obs64.exe
return
It sent my F12 to start and stop streaming (which is what I set OBS to do). Double check and make sure that you have something going with the hotkey otherwise it will look like its done nothing.
Vader_666
Posts: 3
Joined: 30 Dec 2019, 14:13

Re: Autohotkey & OBS issue

31 Dec 2019, 03:05

I'll try that and let you know.
I will also try on another computer, maybe there is something related to my desktop computer ?
Thanks !
yaroslavOreo
Posts: 1
Joined: 21 Jul 2020, 11:39

Re: Autohotkey & OBS issue

21 Jul 2020, 12:04

MannyKSoSo wrote:
30 Dec 2019, 18:44
I double checked on my version (guess it was written in C++ with Qt, never knew). but I was able to get the following working.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MenuMaskKey vk07  ;Takes the extra CTRL event out of Alt+ hotkeys.
SetKeyDelay, -1, 50  ;Simulates holding down the key for 50ms.
^=::
ControlSend, , {F12}, ahk_exe obs64.exe
return
It sent my F12 to start and stop streaming (which is what I set OBS to do). Double check and make sure that you have something going with the hotkey otherwise it will look like its done nothing.
For god, thank you, it made me so annoyed before I found you answer
MannyKSoSo
Posts: 440
Joined: 28 Apr 2018, 21:59

Re: Autohotkey & OBS issue

27 Jul 2020, 10:04

@yaroslavOreo No problem, Glad I could help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Marium0505, mcl and 343 guests