I've noticed a lot of people resorting to strange scripts in order to simply trigger a basic scene change in OBS with AutoHotKey. Some don't even think it's possible.
Well, I'm here to tell you that it is possible and it doesn't have to be as complicated as what I've seen. (No more ChooseStrings. No more ListBoxes. None of that is necessary.)
I did some troubleshooting and figured out that, by default, AHK sends commands too fast for OBS to pickup. (Something like 0.05ms.) This leads some people to believe that OBS doesn't like to accept commands from AHK, but, if you add a proper key delay, that should solve all of your hotkey issues and allow you have a much more simplified script.
Here's the solution I came up with.
This script is set to only activate while OBS is running. If you use it, just make sure you replace my hotkeys with whatever hotkeys you use and change the first sleep value to whatever you need it to be and everything should work! (Leave the second sleep value at 500ms or the hotkeys won't register consistently.)
The example code I've given here uses SHIFT+F2 (represented by +F2 in AHK) as the initial hotkey and then it waits for 3.5s to press SHIFT+F1. So essentially, when I press SHIFT+F2 manually, my scene in OBS will switch to scene 2, then, 3.5s later, it will automatically press SHIFT+F1 and switch back to scene 1, leaving me free to continue doing whatever I need to do on stream. (This is especially valuable to someone who has an interactive board that triggers things in OBS.)
I'll leave this thread up as my solution should work with any version of OBS.
Hope this helps! Happy streaming!
-----
~Imagination is our greatest weapon against reality. Never stop creating!~
Stream lives @ http://beam.pro/Kylix
Well, I'm here to tell you that it is possible and it doesn't have to be as complicated as what I've seen. (No more ChooseStrings. No more ListBoxes. None of that is necessary.)
I did some troubleshooting and figured out that, by default, AHK sends commands too fast for OBS to pickup. (Something like 0.05ms.) This leads some people to believe that OBS doesn't like to accept commands from AHK, but, if you add a proper key delay, that should solve all of your hotkey issues and allow you have a much more simplified script.
Here's the solution I came up with.
This script is set to only activate while OBS is running. If you use it, just make sure you replace my hotkeys with whatever hotkeys you use and change the first sleep value to whatever you need it to be and everything should work! (Leave the second sleep value at 500ms or the hotkeys won't register consistently.)
Code:
+F2::
IfWinExist, ahk_exe obs64.exe
{
Sleep 3000
Send {Shift Down}{F1 Down}
Sleep, 500
Send {F1 Up}{Shift Up}
}
Return
The example code I've given here uses SHIFT+F2 (represented by +F2 in AHK) as the initial hotkey and then it waits for 3.5s to press SHIFT+F1. So essentially, when I press SHIFT+F2 manually, my scene in OBS will switch to scene 2, then, 3.5s later, it will automatically press SHIFT+F1 and switch back to scene 1, leaving me free to continue doing whatever I need to do on stream. (This is especially valuable to someone who has an interactive board that triggers things in OBS.)
I'll leave this thread up as my solution should work with any version of OBS.
Hope this helps! Happy streaming!
-----
~Imagination is our greatest weapon against reality. Never stop creating!~
Stream lives @ http://beam.pro/Kylix
Last edited: