obs = obslua ---------------------------------------------------------- -- A function named script_properties defines the properties that the user -- can change for the entire script module itself function script_properties() local props = obs.obs_properties_create() obs.obs_properties_add_path(props, "execPath", "Executable", obs.OBS_PATH_FILE, "*.exe", nil) return props end -- A function named script_description returns the description shown to -- the user function script_description() return "Starts an executable then OBS is started.\n\nExecutables cannot have spaces in their Name\n\nV0.3 \n\nMade by Davi Be" end -- A function named script_defaults will be called to set the default settings function script_defaults(settings) obs.obs_data_set_default_string(settings, "execPath", "") end -- A function named script_update will be called when settings are changed function script_update(settings) execPath = obs.obs_data_get_string(settings, "execPath") -- replace / by \ execPath = execPath:gsub("/","\\") -- obs.script_log(obs.LOG_INFO, execPath) -- only proceed if there is a file selected if execPath == '' then return nil end -- get Directory index = execPath:match'^.*()\\' execDir = execPath:sub(1,index) -- get Executable execName = execPath:sub(index + 1, execPath:len()) -- assemble command cmd = 'start /D "' .. execDir .. '" ' .. execName obs.script_log(obs.LOG_INFO, cmd) -- execute command os.execute(cmd) end -- a function named script_load will be called on startup function script_load(settings) end -- save additional data not set by user function script_save(settings) end