Help for OBS Studio script

Get help with using AutoHotkey and its commands and hotkeys
Zamfir
Posts: 4
Joined: 07 Jan 2020, 22:06

Help for OBS Studio script

03 Aug 2020, 00:12

Hi guys,

I would like to create a script for OBS Studio that will create a sequence of task;

1) Send 0 (zero) key to OBS Studio,
2) Wait 1 second,
2) Change scene to "TEST" at OBS Studio,
2) Send "!test" command to OBS Studio chat screen and do ENTER.

This script should be triggered by CTRL+L shortcut at my keyboard.

Please advise. :roll:

Thanks!
mshafer1
Posts: 49
Joined: 16 Jul 2017, 14:49
GitHub: mshafer1
Contact:

Re: Help for OBS Studio script

03 Aug 2020, 20:29

you can use ControlSend to specify the target process/window of a key press.

Your requested script my look something like this (untested)

Note: I'm running the 64 bit version of OBS, so for me, the process name is obs64.exe, but you can verify this using the Window Spy (https://amourspirit.github.io/AutoHotkey-Snippit/WindowSpy.html) tool.

Code: Select all


obs_exe := ahk_exe obs64.exe

^l::  ;trigger on ctrl l
    ControlSend, , 0, %obs_exe% ; send a zero to OBS
    Sleep, 1000 ; delay 1 second
    ControlSend, , ^t, %obs_exe% ; send CTRL + t to obs  -  note, use file->settings->Hotkeys->TEST->Switch to scene to set this to switch OBS to the desired scene
   
    ;; TODO: send !test to chat window - I don't have a chat plugin installed, but if it's a seperate window, you can use Window Spy to find the ahk process and/or class name to provide to CTRL send - if it's in the same window, use Window Spy to find the  desired control - or lookup what keyboard shortcuts exist that you can have AHK hit then type the message.
    
    return ; block the original keystroke
gregster
Posts: 5146
Joined: 30 Sep 2013, 06:48

Re: Help for OBS Studio script

03 Aug 2020, 20:31

I think it should be obs_exe := "ahk_exe obs64.exe". It needs to be a string.

Also, afaik, OBS often requires a longer key delay, something like SetKeyDelay 50, 50 (or similar).
Zamfir
Posts: 4
Joined: 07 Jan 2020, 22:06

Re: Help for OBS Studio script

05 Aug 2020, 00:12

@gregster @mshafer0427

Many thanks for your help both!

I have installed the script and ran. However it didn't work. I have set the TEST scene shortcut to CTRL+T. When I press CTRL+L nothing happens. I have also confirmed that manually pressing CTRL+T switches the scene to TEST in OBS. I am using obs64.exe

I have also changed the script with obs_exe := "ahk_exe obs64.exe". Nothing changed.
Zamfir
Posts: 4
Joined: 07 Jan 2020, 22:06

Re: Help for OBS Studio script

07 Aug 2020, 06:35

Bumping to up. :dance:

Return to “Ask For Help”

Who is online

Users browsing this forum: charge, hasantr, RubbeH, songdg and 50 guests