mp.app — 25 functions
| Function | Returns | Description |
|---|---|---|
version() | string | MultiProg app version (e.g. "2.3.0") |
script_api_version() | string | Script 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() | string | Directory of MultiProg.exe |
exe_path() | string | Full path to MultiProg.exe |
config_dir() | string | User config directory |
scripts_dir() | string | Scripts directory |
temp_dir() | string | System temp directory |
home_dir() | string | User home directory |
desktop_dir() | string | User Desktop |
documents_dir() | string | User Documents |
get_env(name) | string | Environment variable |
args() | table | Array of command-line arguments |
log_path() | string | Today's MultiProg log file (same one visible in the log pane) |
log_tail(n?) | string | Last n lines of that log (default 200, cap 10000) |
add_script_shortcut(path) | ok, err | Append 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, err | Remove a path from the Script menu |
list_script_shortcuts() | table | Array of currently-registered user shortcut paths |
cleanup_ipc_dir(names) | int, table | Delete 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