Table of Contents

Add-in Placeholders and Command Context

The add-in evaluates placeholders for the current command context and the affected file or folder.

Placeholder Description
$localPath Current file path, or folder path for a folder-only context
$filePath Current file path; empty for a folder-only context
$fileName, $filename Current file name; empty for a folder-only context
$name Current file or folder name
$fileNameWithoutExtension File name without extension
$extension File extension including the dot, for example .sldprt
$version, $revision Current PDM file version and revision label
$id Current file or folder ID
$state Current workflow state name for the current file
$stateID Current workflow state ID for the current file
$workflow Workflow name for the current file state
$workflowID Workflow ID for the current file state
$folderPath, $directory Current folder path
$folderName Current folder name
$folderID Folder ID
$vaultName Current vault name
$vaultRootFolder Local vault root folder
$GUID Current script execution identifier
$tempFolder, $TempFolder Windows temporary folder
$machineName, $computerName Current machine name
$userName, $username Current PDM user name
$username.firstName, $username.lastName Current PDM user's first and last name when available
$username.FullName Current PDM user's full name when available
$username.email Current PDM user's email address when available
$windowsUser Current Windows user name
$userDomain, $domain Current Windows domain
$configuration, $configurationName Configuration context when provided by the PDM event
$buttonText Card button text when provided by the PDM event
$cmdType, $commandType PDM command type that triggered the script
$cmdId, $commandId PDM command ID when available
$(Variable.@), $(Variable.Configuration) PDM file variable value for the current file
$(Variable) PDM variable using the default file configuration, or a folder variable for a folder context; see below

Date and time values use local time. $yyyy, $MM and $dd give year, month and day. Use $HH for the 24-hour hour, $mi for minutes, and $ss for seconds. $mm means month, not minutes. $timestamp, $date and $time use yyyyMMdd_HHmmss, yyyy-MM-dd and HH-mm-ss. See RUNSCRIPT placeholders for the full list, including session and script-local variables.

Workflow placeholders

Use $state, $stateID, $workflow, and $workflowID when an add-in script needs the selected file's current workflow information.

msgbox -value "$fileName is in $state"

Workflow placeholders require a file context. They evaluate to an empty value when there is no current file or when PDM cannot resolve the file state.

Event placeholders

Each affected item receives its own event values. In a multi-file transition, each file has its own state IDs and paths, including in conditions and nested scripts.

Event placeholders are suggested in script editors, condition dialogs and the expression evaluator. They are not suggested in the interactive command box, where no PDM event is being handled.

Event values describe the original callback, not a later lookup of live file state. Unavailable semantic values are empty; raw numeric zero is preserved. Outside an event, event-only placeholders are empty. Previewing a standalone expression does not invent a transition event.

Workflow transitions

Placeholder Meaning
$fromState, $fromStateID Original state name and ID from a state-change hook.
$toState, $toStateID Destination state name and ID. Before hooks describe the requested change; after hooks describe the completed change.
$transition, $transitionID Transition name and ID supplied by the state-change hook.
$eventUserID, $eventUserName User performing the transition, which may differ from the script's logged-in account. Empty for other hooks.
msgbox -value "$fileName: $fromState -> $toState via $transition (ID $transitionID)"

Use $state for the file's current state. Use $fromState and $toState for the transition snapshot. $cmdId is a command ID, not a transition ID.

Callback and item context

Placeholder Meaning
$cmdType, $commandType, $eventType Callback type, such as EdmCmd_PreState.
$cmdId, $commandId EdmCmd.mlCmdID.
$eventPhase Before for Pre hooks, After for Post hooks, otherwise empty.
$eventItemCount Original number of callback rows, before filtering.
$eventItemIndex One-based original row index; filtering does not renumber it.
$eventComment Event-wide comment. Its meaning depends on the hook; for a card button it is the button command.
$eventCurrentFolderID Event-wide current folder ID, not necessarily the item's parent.
$eventObjectType Object type supplied by a task callback: EdmObject_File or EdmObject_Folder.

Paths and other event data

Placeholder Meaning
$eventPath Original path supplied by a supported hook or task, not reconstructed from live state.
$sourcePath, $destinationPath Paths supplied by supported move, copy, share, or get hooks.
$sourceFolderID, $destinationFolderID Folder IDs for move/copy/share. For folder moves or destination folder copies, these are parent-folder IDs.
$oldName, $newName Names supplied by rename hooks, not full paths.
$eventVersion Requested version in PreGet/PostGet, or local version supplied by TaskLaunch; not necessarily the latest.
$buttonText Card button command string from the event comment.
$configurationName Configuration from a card-button, serial-number, or task callback; also available as $configuration there.
$labelName, $labelID Label name and ID; a new label has no ID before creation.
$labelRecursive True/False recursive flag supplied by label creation/add-item hooks.
$serialCounter Serial-number callback counter. Reading it does not generate or assign a serial number.
$cardID Card ID from a card-button or serial-number callback.
$controlID Control ID from a serial-number callback.

Raw callback fields

$objectID1, $objectID2, $objectID3, $objectID4, $strData1, $strData2, $strData3, $longData1, $longData2, and $longData3 expose scalar fields from the current item's EdmCmdData row. Their meanings vary by $eventType; prefer the named placeholders above where available. COM objects such as mpoExtra are not exposed or retained.

Text from events is treated as data, not another command or expression. Quotes, backslashes, and expression-looking text inside a callback value remain literal.

PDM variables

Use $(Variable.Configuration) to read PDM variable values from files. Use .@ for the file @ tab. Folder variables can use $(Variable) because folders do not use file configurations.

"$(Description.@)" contains "ECO"
"$(Revision.@)" equals "A"

Use $(Description.@) to explicitly read the file @ tab, or a named configuration such as $(Description.Default). Without a suffix, SOLIDWORKS parts and assemblies default to @; other files use the empty configuration. For folders, $(Description) reads the folder variable. Bracketed text such as [Description] is literal and is not evaluated as a PDM variable.