Auto Scene Switcher by Active Window (WIN Only)
What the Script Does
The script monitors the foreground window using Windows WinAPI (via LuaJIT) and compares the window’s executable name and title against a list of user-configurable rules. When a match is found, OBS switches to the specified scene.It supports up to eight independent rules, allowing flexible automation for gaming, productivity, communication apps, or any other workflow where different scenes are needed depending on the program in focus.
Key Features
- Automatic scene switching based on active window
- Match rules by executable name, window title, or both
- Optional additional substring filter for precise title matching
- Up to 8 configurable rules
- Adjustable polling interval (how often the active window is checked)
- Adjustable cooldown to prevent rapid scene changes
- Refresh button for updating the list of currently open windows
- Fully integrated script settings panel inside OBS
Requirements
- OBS Studio for Windows
- LuaJIT (included in OBS)
- WinAPI access (Windows-only not compatible with macOS or Linux)
Installation
- Download the .lua file.
- Open OBS Studio.
- Go to Tools → Scripts.
- Click the + icon and add the script.
- Configure your rules and settings in the script properties panel.
Some Notes
- Only top-level visible windows are listed when refreshing.
- Scene names must match exactly as they appear inside OBS.
- Rules are checked in order, the first matching rule is executed.
- For more complex matching, combine "Any window" with a custom title filter.
Ko-fi: https://ko-fi.com/mmltech
PayPal: https://paypal.me/mmlTools