This document lists all special words (__FOO__) and their corresponding environment variables ($OMC_FOO) that the OMC engine resolves at runtime.
The list is derived directly from the source files:
AbracodeFramework/CommandDescription.cp– core substitution and export logicAbracodeFramework/NibDialogControl.cp– NIB / WebView parsing
| Step | What happens |
|---|---|
| 1. Substitution | Every __FOO__ separate string in a command array (COMMAND, NAME, WARNING, etc.) is replaced with its resolved value before execution. |
| 2. Automatic Export | The following variables are always exported (regardless of scanning):$OMC_OBJ_TEXT, $OMC_OBJ_PATH, $OMC_OMC_RESOURCES_PATH, $OMC_OMC_SUPPORT_PATH, $OMC_APP_BUNDLE_PATH, $OMC_APP_PROCESS_ID, $OMC_NIB_DLG_GUID, $OMC_CURRENT_COMMAND_GUID.$OMC_OBJ_TEXT is always present, but it carries text only as step 2a says. |
2a. Where $OMC_OBJ_TEXT comes from |
The run's own text, when it has one: a URL's text, a service's selected text, a command run with text context. With none, the engine looks for text (the selection, else the clipboard) only when the command declares the text object: __OBJ_TEXT__ in COMMAND or INPUT_PIPE, or an OMC_OBJ_TEXT key in ENVIRONMENT_VARIABLES (any string value, such as ""). A command that does neither, which includes every exe_script_file command that does not list it, gets an empty $OMC_OBJ_TEXT, and the clipboard is never read for it. This is deliberate: an applet command run from a menu or a button should not pick up whatever happens to be on the clipboard. |
| 3. Export detection | For all other variables, the engine scans the COMMAND array for the literal string OMC_FOO. If found, the resolved value is exported (for modes that support env vars). |
| 4. External scripts | exe_script_file scripts are not scanned. Force export via ENVIRONMENT_VARIABLES. |
5. NAME arrays |
Only __FOO__ works in dynamic labels – env vars are not expanded. |
| Category | Special Word | Environment Variable | Description | Export |
|---|---|---|---|---|
| Object | __OBJ_PATH__ |
$OMC_OBJ_PATH |
Full path (escaped). | Always |
| Object | __OBJ_TEXT__ |
$OMC_OBJ_TEXT |
The run's text; else, for a command that declares it, the selected text or the clipboard (step 2a). | Always (empty unless the run brought text or the command declares it) |
| Object | __OBJ_NAME__ |
$OMC_OBJ_NAME |
Base name (folder ends with /). |
Scanned |
| Object | __OBJ_NAME_NO_EXTENSION__ |
$OMC_OBJ_NAME_NO_EXTENSION |
Name without extension. | Scanned |
| Object | __OBJ_EXTENSION_ONLY__ |
$OMC_OBJ_EXTENSION_ONLY |
Extension only (no dot). | Scanned |
| Object | __OBJ_DISPLAY_NAME__ |
$OMC_OBJ_DISPLAY_NAME |
Localized display name. | Scanned |
| Object | __OBJ_PARENT_PATH__ |
$OMC_OBJ_PARENT_PATH |
Parent directory path. | Scanned |
| Object | __OBJ_COMMON_PARENT_PATH__ |
$OMC_OBJ_COMMON_PARENT_PATH |
Common parent for multiple objects. | Scanned |
| Object | __OBJ_PATH_RELATIVE_TO_COMMON_PARENT__ |
$OMC_OBJ_PATH_RELATIVE_TO_COMMON_PARENT |
Relative path from common parent. | Scanned |
| Dialog | __DLG_INPUT_TEXT__ |
$OMC_DLG_INPUT_TEXT |
Input dialog text. | Scanned |
| Save As | __DLG_SAVE_AS_PATH__ |
$OMC_DLG_SAVE_AS_PATH |
Save-As path. | Scanned |
| Save As | __DLG_SAVE_AS_PARENT_PATH__ |
$OMC_DLG_SAVE_AS_PARENT_PATH |
Save-As parent directory. | Scanned |
| Save As | __DLG_SAVE_AS_NAME__ |
$OMC_DLG_SAVE_AS_NAME |
Save-As filename. | Scanned |
| Save As | __DLG_SAVE_AS_NAME_NO_EXTENSION__ |
$OMC_DLG_SAVE_AS_NAME_NO_EXTENSION |
Save-As name without extension. | Scanned |
| Save As | __DLG_SAVE_AS_EXTENSION_ONLY__ |
$OMC_DLG_SAVE_AS_EXTENSION_ONLY |
Save-As extension only. | Scanned |
| Choose File | __DLG_CHOOSE_FILE_PATH__ |
$OMC_DLG_CHOOSE_FILE_PATH |
Chosen file path. | Scanned |
| Choose File | __DLG_CHOOSE_FILE_PARENT_PATH__ |
$OMC_DLG_CHOOSE_FILE_PARENT_PATH |
Chosen file parent. | Scanned |
| Choose File | __DLG_CHOOSE_FILE_NAME__ |
$OMC_DLG_CHOOSE_FILE_NAME |
Chosen file name. | Scanned |
| Choose File | __DLG_CHOOSE_FILE_NAME_NO_EXTENSION__ |
$OMC_DLG_CHOOSE_FILE_NAME_NO_EXTENSION |
Chosen file name without extension. | Scanned |
| Choose File | __DLG_CHOOSE_FILE_EXTENSION_ONLY__ |
$OMC_DLG_CHOOSE_FILE_EXTENSION_ONLY |
Chosen file extension only. | Scanned |
| Choose Folder | __DLG_CHOOSE_FOLDER_PATH__ |
$OMC_DLG_CHOOSE_FOLDER_PATH |
Chosen folder path. | Scanned |
| Choose Folder | __DLG_CHOOSE_FOLDER_PARENT_PATH__ |
$OMC_DLG_CHOOSE_FOLDER_PARENT_PATH |
Chosen folder parent. | Scanned |
| Choose Folder | __DLG_CHOOSE_FOLDER_NAME__ |
$OMC_DLG_CHOOSE_FOLDER_NAME |
Chosen folder name. | Scanned |
| Choose Folder | __DLG_CHOOSE_FOLDER_NAME_NO_EXTENSION__ |
$OMC_DLG_CHOOSE_FOLDER_NAME_NO_EXTENSION |
Chosen folder name without extension. | Scanned |
| Choose Folder | __DLG_CHOOSE_FOLDER_EXTENSION_ONLY__ |
$OMC_DLG_CHOOSE_FOLDER_EXTENSION_ONLY |
Chosen folder extension only. | Scanned |
| Choose Object | __DLG_CHOOSE_OBJECT_PATH__ |
$OMC_DLG_CHOOSE_OBJECT_PATH |
Chosen object path. | Scanned |
| Choose Object | __DLG_CHOOSE_OBJECT_PARENT_PATH__ |
$OMC_DLG_CHOOSE_OBJECT_PARENT_PATH |
Chosen object parent. | Scanned |
| Choose Object | __DLG_CHOOSE_OBJECT_NAME__ |
$OMC_DLG_CHOOSE_OBJECT_NAME |
Chosen object name. | Scanned |
| Choose Object | __DLG_CHOOSE_OBJECT_NAME_NO_EXTENSION__ |
$OMC_DLG_CHOOSE_OBJECT_NAME_NO_EXTENSION |
Chosen object name without extension. | Scanned |
| Choose Object | __DLG_CHOOSE_OBJECT_EXTENSION_ONLY__ |
$OMC_DLG_CHOOSE_OBJECT_EXTENSION_ONLY |
Chosen object extension only. | Scanned |
| System | __OMC_RESOURCES_PATH__ |
$OMC_OMC_RESOURCES_PATH |
Path to OMC framework Resources. | Always |
| System | __OMC_SUPPORT_PATH__ |
$OMC_OMC_SUPPORT_PATH |
Path to OMC support files. | Always |
| System | __APP_BUNDLE_PATH__ |
$OMC_APP_BUNDLE_PATH |
Applet bundle path (preferred). | Always |
| System | __APP_PROCESS_ID__ |
$OMC_APP_PROCESS_ID |
PID of the applet/host app itself, not the frontmost app. | Always |
| System | __MY_EXTERNAL_BUNDLE_PATH__ |
$OMC_MY_EXTERNAL_BUNDLE_PATH |
External .omc bundle path. |
Scanned |
| Dialog | __NIB_DLG_GUID__ |
$OMC_NIB_DLG_GUID |
Unique NIB dialog instance GUID. | Always |
| Dialog | __ACTIONUI_WINDOW_UUID__ |
$OMC_ACTIONUI_WINDOW_UUID |
Unique ActionUI window UUID. OMC 5.0 | Always |
| ActionUI Trigger | __ACTIONUI_TRIGGER_VIEW_ID__ |
$OMC_ACTIONUI_TRIGGER_VIEW_ID |
ViewID of the ActionUI control that fired an action. Available only when subcommand is dispatched from a control action. | Always (when set) |
| ActionUI Trigger | __ACTIONUI_TRIGGER_VIEW_PART_ID__ |
$OMC_ACTIONUI_TRIGGER_VIEW_PART_ID |
ViewPartID of the control event (e.g. row index for table row tap). Available only when subcommand is dispatched from a control action. | Always (when set) |
| ActionUI Trigger | __ACTIONUI_TRIGGER_CONTEXT__ |
$OMC_ACTIONUI_TRIGGER_CONTEXT |
Opaque context payload from the ActionUI control event (string, JSON, or number). Available only when subcommand is dispatched from a control action AND the control provided context data. | Always (when set) |
| ActionUI Bridge | __ACTIONUI_REMOTE_ENDPOINT__ |
$OMC_ACTIONUI_REMOTE_ENDPOINT |
Unix socket path of this host's ActionUI remote bridge, for reading and driving its windows out of process. Set once the first ActionUI window opens, and for the rest of the process. Also exported unprefixed as $ACTIONUI_REMOTE_ENDPOINT, which is the name the protocol itself uses. OMC 5.3 |
Always (when set) |
| System | __CURRENT_COMMAND_GUID__ |
$OMC_CURRENT_COMMAND_GUID |
Unique command execution GUID. | Always |
| URL Trigger | (none) | $OMC_TRIGGER_URL |
The URL that started this run, when it was started by a URL sent to the applet (the exe form or omc.app.handle-url). Absent for every other run. Also set for chained commands and for the handlers of a window the run opened. Environment variable only: there is no text substitution, because the URL is written by the sender of the link. See URL_INVOCABLE in the Command Reference. |
Always (when set) |
| Frontmost | __FRONT_PROCESS_ID__ |
$OMC_FRONT_PROCESS_ID |
PID of frontmost app. | Scanned |
| Frontmost | __FRONT_APPLICATION_NAME__ |
$OMC_FRONT_APPLICATION_NAME |
Name of frontmost app. | Scanned |
| Special Word | Environment Variable | Notes |
|---|---|---|
__MY_HOST_BUNDLE_PATH__ |
$OMC_MY_HOST_BUNDLE_PATH |
Deprecated |
__INPUT_TEXT__ |
$OMC_INPUT_TEXT |
Use OMC_DLG_INPUT_TEXT |
__OBJ_PATH_NO_EXTENSION__ |
$OMC_OBJ_PATH_NO_EXTENSION |
Not needed |
__PASSWORD__ |
$OMC_PASSWORD |
Use OMC_DLG_INPUT_TEXT with password input |
__SAVE_AS_PATH__ |
$OMC_SAVE_AS_PATH |
Use OMC_DLG_SAVE_AS_PATH |
__SAVE_AS_PARENT_PATH__ |
$OMC_SAVE_AS_PARENT_PATH |
Use OMC_DLG_SAVE_AS_PARENT_PATH |
__SAVE_AS_FILE_NAME__ |
$OMC_SAVE_AS_FILE_NAME |
Use OMC_DLG_SAVE_AS_NAME |
__MY_BUNDLE_PATH__ |
$OMC_MY_BUNDLE_PATH |
Use $OMC_APP_BUNDLE_PATH |
exe_script_file does not scan the script body for OMC_FOO references, so non-auto variables must be declared explicitly via ENVIRONMENT_VARIABLES:
<dict>
<key>COMMAND_ID</key>
<string>my_action</string>
<key>EXECUTION_MODE</key>
<string>exe_script_file</string>
<key>ENVIRONMENT_VARIABLES</key>
<dict>
<key>OMC_OBJ_NAME</key>
<string></string>
<key>OMC_DLG_INPUT_TEXT</key>
<string></string>
</dict>
</dict>The empty string values are placeholders — the resolved values are substituted at runtime.
Script:
#!/bin/bash
echo "File: ${OMC_OBJ_NAME}"
echo "Input: ${OMC_DLG_INPUT_TEXT}"<key>NAME</key>
<array>
<string>Process: </string>
<string>__OBJ_NAME__</string>
</array>Access NIB dialog control values using dynamic special words:
| Special Word | Environment Variable | Description |
|---|---|---|
__NIB_DIALOG_CONTROL_<ID>_VALUE__ |
OMC_NIB_DIALOG_CONTROL_<ID>_VALUE |
Value of NIB control with given tag. |
__NIB_TABLE_<ID>_COLUMN_<COL>_VALUE__ |
OMC_NIB_TABLE_<ID>_COLUMN_<COL>_VALUE |
Table selected cell value. |
__NIB_TABLE_<ID>_COLUMN_<COL>_ALL_ROWS__ |
OMC_NIB_TABLE_<ID>_COLUMN_<COL>_ALL_ROWS |
All rows in table column (expensive). |
__NIB_WEBVIEW_<ID>_ELEMENT_<ELEM>_VALUE__ |
OMC_NIB_WEBVIEW_<ID>_ELEMENT_<ELEM>_VALUE |
WebView element value. |
Access ActionUI view values using dynamic special words:
| Special Word | Environment Variable | Description |
|---|---|---|
__ACTIONUI_VIEW_N_VALUE__ |
OMC_ACTIONUI_VIEW_N_VALUE |
Value of ActionUI view with given integer ID. |
__ACTIONUI_TABLE_<ID>_COLUMN_<N>_VALUE__ |
OMC_ACTIONUI_TABLE_<ID>_COLUMN_<N>_VALUE |
ActionUI Table selected row, column N (1-based). |
__ACTIONUI_TABLE_<ID>_COLUMN_<N>_ALL_ROWS__ |
OMC_ACTIONUI_TABLE_<ID>_COLUMN_<N>_ALL_ROWS |
ActionUI Table all rows in column N (1-based). |
__ACTIONUI_TABLE_<ID>_COLUMN_0_VALUE__ |
OMC_ACTIONUI_TABLE_<ID>_COLUMN_0_VALUE |
ActionUI Table selected row, all columns combined (tab-separated). |
Note: Table column indexes are 1-based (column 1, 2, 3, ...). Column 0 is special - it returns all columns combined as a tab-separated string.
When a subcommand is dispatched by tapping / clicking an ActionUI control (button, table row, picker option, etc.), three context variables become available in the child process environment:
| Special Word | Environment Variable | Description | Availability |
|---|---|---|---|
__ACTIONUI_TRIGGER_VIEW_ID__ |
$OMC_ACTIONUI_TRIGGER_VIEW_ID |
The integer ID of the ActionUI control that fired the action. | Only when dispatched from a control action. |
__ACTIONUI_TRIGGER_VIEW_PART_ID__ |
$OMC_ACTIONUI_TRIGGER_VIEW_PART_ID |
The integer part ID within that control — typically a row or column index. | Only when dispatched from a control action. |
__ACTIONUI_TRIGGER_CONTEXT__ |
$OMC_ACTIONUI_TRIGGER_CONTEXT |
The opaque context payload from the control, if any. Serialized as string, number, or compact JSON. | Only when dispatched from a control action AND the control provided context data. |
When are these available?
These variables are only present when the subcommand is dispatched by a control action. They are not available when the subcommand is triggered by:
- Dialog initialization (
initsubcommand) - Command activation (
activatesubcommand) - Command deactivation (
deactivatesubcommand) - Dialog or window close
How to check if context is available:
if [ -n "$OMC_ACTIONUI_TRIGGER_VIEW_ID" ]; then
# Subcommand was triggered from a control action
echo "View: $OMC_ACTIONUI_TRIGGER_VIEW_ID, Part: $OMC_ACTIONUI_TRIGGER_VIEW_PART_ID"
echo "View Context: $OMC_ACTIONUI_TRIGGER_CONTEXT"
fiExample: Handling a table row tap
#!/bin/bash
# A table changed selected row
if [ -n "$OMC_ACTIONUI_TRIGGER_VIEW_ID" ]; then
view_id="${OMC_ACTIONUI_TRIGGER_VIEW_ID}"
view_part_id="${OMC_ACTIONUI_TRIGGER_VIEW_PART_ID}"
view_context_json="${OMC_ACTIONUI_TRIGGER_CONTEXT}"
echo "Table ${view_id} changed selected row"
echo "Table row selection context: ${view_context_json}"
fiSerialization of $OMC_ACTIONUI_TRIGGER_CONTEXT:
The context is an opaque value provided by the ActionUI control and is serialized as follows:
- String → passed as-is
- Number → converted to string form (e.g.,
"42") - Dictionary / Array → serialized as compact JSON (no pretty-printing)
- Other → stringified via description
- nil / absent → env var is not exported (variable is absent from environment)
Important: $OMC_ACTIONUI_TRIGGER_VIEW_ID and $OMC_ACTIONUI_TRIGGER_VIEW_PART_ID are always available when any control action fires, but $OMC_ACTIONUI_TRIGGER_CONTEXT may or may not be present depending on whether the control provided data.
An applet with an ActionUI window also serves a small JSON-RPC bridge over a Unix socket, so a command handler can read window state, not just write it. Two variables address it, and both are set for every handler once the first ActionUI window has opened:
| Variable | Set from | Notes |
|---|---|---|
$OMC_ACTIONUI_REMOTE_ENDPOINT |
special word __ACTIONUI_REMOTE_ENDPOINT__ |
OMC's own spelling, consistent with every other engine variable. |
$ACTIONUI_REMOTE_ENDPOINT |
the process environment, and the environment dictionary | The name the ActionUI protocol defines. Descendant processes inherit it directly; it is also placed in the command's environment dictionary so the Terminal and iTerm modes, which hand an export script to an app that is not a descendant, carry it too. |
$ACTIONUI_WINDOW_UUID |
the environment dictionary | The unprefixed alias of $OMC_ACTIONUI_WINDOW_UUID, so a client need not know it is talking to OMC. |
Both endpoint names carry the same value; the unprefixed pair is what a plain ActionUI client expects, so a script written against the protocol runs unchanged whether its host is an OMC applet or any other ActionUI application:
import actionui_remote
win = actionui_remote.Window.from_environment() # reads ACTIONUI_REMOTE_ENDPOINT and ACTIONUI_WINDOW_UUID
print(win.get_value(101))Writing to a window continues to go through omc_dialog_control, which covers every mutation verb; the bridge adds the reads that were not possible before. The variables are absent in an applet with no ActionUI window, since nothing starts the bridge.
- Prefer
$OMC_FOOin scripts – always quote"${OMC_FOO}".- Use
__FOO__only inNAMEarrays or forexe_system/exe_applescript.- Do not use deprecated synonyms in new code.
- Force export for non-auto variables in
exe_script_file.