Skip to main content

mp.app — 25 functions

FunctionReturnsDescription
version()stringMultiProg app version (e.g. "2.3.0")
script_api_version()stringScript API version (e.g. "1.7.10", format major.minor.patch) — increments on any API change
build_info()table{git_hash, build_time, qt_version, compiler, platform, script_api}
os_info()table{os, os_version, kernel, kernel_version, cpu_arch, hostname}
exe_dir()stringDirectory of MultiProg.exe
exe_path()stringFull path to MultiProg.exe
config_dir()stringUser config directory
scripts_dir()stringScripts directory
temp_dir()stringSystem temp directory
home_dir()stringUser home directory
desktop_dir()stringUser Desktop
documents_dir()stringUser Documents
get_env(name)stringEnvironment variable
args()tableArray of command-line arguments
log_path()stringToday's MultiProg log file (same one visible in the log pane)
log_tail(n?)stringLast n lines of that log (default 200, cap 10000)
add_script_shortcut(path)ok, errAppend a .lua path to the user's Script menu (persisted across restarts). Accepts an absolute path OR a bare filename
remove_script_shortcut(path)ok, errRemove a path from the Script menu
list_script_shortcuts()tableArray of currently-registered user shortcut paths
cleanup_ipc_dir(names)int, tableDelete files in the IPC bridge dir; names is a Lua array of plain filenames (no / or \). Hard whitelist protects critical files

Example

mp.log.info(mp.app.version()) -- "2.3.0"
mp.log.info(mp.app.script_api_version()) -- "1.7.10"

local b = mp.app.build_info()
mp.log.infof("git=%s qt=%s build=%s",
b.git_hash, b.qt_version, b.build_time)

local o = mp.app.os_info()
mp.log.infof("os=%s arch=%s host=%s",
o.os, o.cpu_arch, o.hostname)

mp.log.info("scripts: " .. mp.app.scripts_dir())
mp.log.info("config: " .. mp.app.config_dir())
mp.log.info("today's log: " .. mp.app.log_path())

-- Make a custom script appear in the Script menu after restart
mp.app.add_script_shortcut("C:/scripts/my_flow.lua")
for _, p in ipairs(mp.app.list_script_shortcuts()) do
mp.log.info(p)
end