-- hotkey_launch.lua
obs = obslua
local hotkey_id = obs.OBS_INVALID_HOTKEY_ID
-- Change this to your executable path
local executable_path = [[C:\Path\To\Your\Executable.exe]]
function script_description()
return "Launch an external executable via hotkey"
end
function on_hotkey_pressed(pressed)
if not pressed then
return
end
obs.script_log(obs.LOG_INFO, "Launching executable...")
-- Launch the process (non-blocking on Windows if using 'start')
os.execute(string.format('start "" "%s"', executable_path))
end
function script_load(settings)
hotkey_id = obs.obs_hotkey_register_frontend(
"launch_executable_hotkey",
"Launch External Executable",
on_hotkey_pressed
)
local hotkey_array = obs.obs_data_get_array(settings, "launch_executable_hotkey")
obs.obs_hotkey_load(hotkey_id, hotkey_array)
obs.obs_data_array_release(hotkey_array)
end
function script_save(settings)
local hotkey_array = obs.obs_hotkey_save(hotkey_id)
obs.obs_data_set_array(settings, "launch_executable_hotkey", hotkey_array)
obs.obs_data_array_release(hotkey_array)
end