Start recording automatically when specific window is active

samwzlim

New Member
Is there any way to get OBS to automatically start recording a zoom meeting as soon as I enter the meeting? I have selected window capture in sources and the window is [Zoom.exe]: Zoom. Will it be possible for OBS to start recording when as soon as the window '[Zoom.exe]: Zoom' is active? Then, as soon as this window is closed, OBS will stop recording instantly. On paper, it seems doable, but I have no experience in programming/coding to come up with anything myself. Is there already a plugin/tool for this or can someone guide me on how this can be done?
 

carlmmii

Active Member
AutoHotKey script. This checks every second to see whether Zoom.exe is active, and uses Ctrl+F7 and Ctrl+F8 to Start/Stop recording (you would need to set these hotkeys in OBS).

Code:
check_delay := 1000
hotkey_delay := 50
is_active := false

Loop
{
    if WinActive("ahk_exe Zoom.exe")
    {
        if(!is_active)
        {
            is_active := true
            
            Send {Ctrl down}{F7 down}
            Sleep, %hotkey_delay%
            Send {Ctrl up}{F7 up}
        }
    }
    else if(is_active)
    {
        is_active := false
        
        Send {Ctrl down}{F8 down}
        Sleep, %hotkey_delay%
        Send {Ctrl up}{F8 up}
    }
    
    Sleep, %check_delay%
}
 

samwzlim

New Member
@carlmmii This is really cool! However, I'm concerned if AHK checking every second to see whether Zoom.exe is active takes up lots of resources, as my computer isn't that beefy. Is there a more elegant solution to this, perhaps a plugin within OBS? For example, OBS would only start the screen recording as soon as Zoom.exe is recognized, therefore eliminating the need for periodical checking. Thanks for the script anyways!
 

samwzlim

New Member
@carlmmii I just tested this script out, but it seems like the recording stops as long as I click any other window? How do I ensure that OBS continues recording even if I click on other windows? I would like OBS to start recording as long as the window is present, doesn't matter if it's in focus or not
 

samwzlim

New Member
@carlmmii The script is working well, thanks! I would like to take it a step further and only have OBS automatically start the recording when [Zoom.exe]: Zoom exists. I keep Zoom open all the time, as I wish to receive messages, so would it be possible for for the recording to start ONLY when the meeting starts? The meeting window's name is just Zoom.
 

Ransom22

New Member
This is exactly what I'm also looking to do. I tested this script today but got an error in OBS saying "invalid syntax." I'm just getting into scripting so any help is much appreciated.

Update: After reading a few other threads, it looks like there may be modules that are needed. Can you let me know which ones I should download? Thank you
 
Last edited:

ThunderKathryn

New Member
Hi there! Having something like this would be great, but when I try to run the script it gives me this error:

[auto record.lua] Error loading file: ...rive/Streaming Files/00 - Assets/Plugins/auto record.lua:1: '<name>' expected near '='

I'm trying to load it as a .lua script but it's possible I'm doing it wrong. Can you provide steps for loading this into OBS?
 

koala

Active Member
The above script is a Autohotkey script, no lua. You need Autohotkey to run it, you cannot load it as OBS plugin.
Its usefulness is limited, because it will not (probably cannot) determine if a meeting is actually being started or not. It's just checking for zoom.exe being the foreground window (or being just running with the modification).

Try the advanced scene switcher mentioned above. It has the ability to automatically start/stop streaming/recording on a huge number of conditions. If Zoom changes its window title if a meeting is active, the scene switcher can be configured to pick that up and synchronize recording start/stop with a meeting starting/stopping.
 
Top