Skip to content
Sponsored
Sponsored
OBS Auto Scene Switcher by Active Window Simple Lua Script for Automatic Scene Switching
obs-tools-plugins

OBS Auto Scene Switcher by Active Window Simple Lua Script for Automatic Scene Switching

Published: 2025-11-25 10:35:31

OBS Auto Scene Switcher by Active Window (Windows Only)

A lightweight OBS Lua script that automatically switches scenes based on the currently active window. Ideal for streamers, educators, and content creators who need clean, hands-free scene management.

OBS Auto Scene Switcher Screenshot

Overview

The OBS Auto Scene Switcher by Active Window uses Windows WinAPI (via LuaJIT FFI) to detect the foreground window and compare it against up to 8 user-defined rules. When a rule matches based on executable name, window title, or both OBS Studio switches to the associated scene. This script is Windows-only and integrates directly into the OBS Tools → Scripts interface for fast configuration.

If you frequently swap between a game client, browser, IDE, or presentation, this script provides hands-free automation and a more professional viewer experience.

GitHub Repository

Key Features

  • Automatic scene switching based on active window or application.
  • Support for up to 8 independent rules, evaluated in order.
  • Match by executable name, window title, or both, with optional title substring filtering.
  • Adjustable polling interval (ms) and switch cooldown (ms) to prevent rapid switching.
  • Real time Refresh Windows List button.
  • Integrated configuration inside OBS Studio.
  • Windows only due to WinAPI dependency.

Installation

  1. Download the .lua script: https://github.com/mmlTools/smart-scene-autoswitcherSmart Scene Auto Switcher.
  2. Open OBS Studio (Windows).
  3. Go to Tools → Scripts.
  4. Click the + icon and select the downloaded script file.
  5. Open the script's settings and configure your rules.

Requirements: OBS Studio (Windows) with LuaJIT support (included by default).

Configuration & Rules

Global Options

  • Enabled Master on/off switch.
  • Poll Interval (ms) How often the active window is checked.
  • Switch Cooldown (ms) Minimum delay between scene changes.
  • Refresh Windows List Updates the visible windows list.

Rule Options (1-8)

  • Enable rule
  • Target window (specific window or “Any window”)
  • Optional title filter
  • Scene to switch to

Rules are evaluated in order, and the first matching rule is applied.

Practical Use Cases

1) Gaming Streams with Multiple Apps

Map your launcher to a “Lobby Scene” and the game client to “Gameplay Scene.” As you move between windows, scene switching happens automatically.

2) Software Tutorials

Associate Photoshop with a “Design Scene” and Chrome with a “Browser Scene.” Your audience always sees the correct context no manual switching.

3) Coding Streams

Link your IDE to “Coding Scene” and the terminal to “Console Scene.” Achieve a professional flow that keeps viewers engaged.

4) Live Shows & Notes

If you open Word for notes mid-show, switch to a clean “Notes Scene” and return to your Default Scene when focusing back on OBS.

5) Training & Demos

Pair PowerPoint with “Presentation Scene” and Excel with “Data Scene” for smooth transitions in recorded training sessions.

Tips & Limitations

  • Use precise executable names for reliable matching.
  • Set a sensible cooldown to avoid rapid switching.
  • Test rules before going live; keep a manual hotkey override.
  • Windows-only: macOS/Linux not supported due to WinAPI dependency.
  • Requires top-level visible windows; minimized/hidden windows won't trigger.

Troubleshooting

  • Empty window list: Press Refresh Windows List.
  • Scene not switching: Ensure the rule is enabled, the scene name exists, and cooldown isn't blocking.
  • No detection: Confirm you're on Windows and using visible top-level windows.

FAQ

Is this the same as Advanced Scene Switcher?

No. This is a simple Lua script focused solely on active window-based switching on Windows. It does not include timers or broader macro systems.

Will it work on macOS or Linux?

No. It relies on WinAPI, which is not available on macOS or Linux.

How many rules can I configure?

Up to 8 independent rules, evaluated in order. The first matching rule triggers the scene switch.

Where do I configure it in OBS?

Go to Tools → Scripts, add the script, and set your global options plus rule options.

Sponsored