# Escape Sequences

Most action functions support escape sequences in text fields. All of the escape sequences can be inserted into a text field via a text field's context menu.

Note that unless otherwise mentioned, alphabetic case is ignored in Yate escape sequences. The following table describes the supported escape sequences, a menu item and description.

When the Menu Item column is black, the sequence can be inserted from a submenu on the Insert Yate Escape Sequence context menu. When it is blue it represents the name of a context menu from which you can choose the named item you desire. Information on each menu can be found below the following table.

Sequence | Menu Item | Description
--- | --- | ---
Action Sequences |
\#setting# | Insert Runtime Setting | is used to insert the value of an action runtime setting
\#<varname> | Runtime Setting in Named Variable | the named variable specifies the name of an action runtime setting whose value is to be inserted
\?rs | Action Runtime Setting Mapping | inserts the name of the runtime settings set associated with the runtime setting mapping. This is Action Runtime Settings unless it has been modified by the Map Action Runtime Settings statement.
\a1 | Action Test State (0 or 1) | insert the value of the Action Test State as '0' for false and '1' for true.
\a0 | Action Test State (empty or 1) | insert the value of the Action Test State as 'empty for false and '1' for true.
\?nv | List of named variables | insert a list representing the names of all named variables. Note that named variables which have an empty value are not represented. The list items are delimited by the default list delimiter (\~).
\an | Name of Current Action | the name of the currently executing action, inline or not.
\af | Name of Current Action (Non inline) | if not executing an inline action this sequence is the same as \an. If an inline action is executing, this sequence will always return the name of the containing non inline action.
\ai | Name of Initial Action | The name of the action initially started.
\av | Version Number of Current Action | returns the version number on the executing action file's Version statement, if available.
\a3 | Version Number of Initial Action | returns the version number on the initital action file's Version statement, if available.
\at | Descriptive Text of Current Action | returns the descriptive text of the action, if available. An action's description is the first non empty content in a Comment, Force Grouped, Tooltip or Version statement. A search for a description is terminated at the first enabled statement which is not one of the preceding statements or an Empty Line or Constrain Execution to a Single File statement.
\a2 | Descriptive Text of Initial Action | Same as \at but always returns the descriptive text of the initial action.
\ad | Action Has Online Help | returns 1 if the executing action file has associated online help, otherwise 0.
\p | Name of Calling Action | The name of the action which called the current executing action. This can return three possible forms: an empty string The executing action was called directly from the UI or Batch Processor. name name is the name of a non inline action. name1⏎name2 name2 is the name of an inline action in non inline action name1
Character Sequences |
\_ | Alternate Comma | insert an alternate comma (‚) character. In Involved People and Musician Credits fields, real comma characters should only be used as delimiters
\\ | Backslash Character | the correct form to specify a single \ character
\. | Centered Dot Character | inserts a centered dot character. This can be useful as a replacement character when debugging and looking for spaces in fields
\?rx | Invalid Character Substitution Sequence | inserts the Preferences - Rename Invalid character substitution field
\, | List Column Delimiter | insert the default list column delimiter ➤
\~ | List Delimiter | insert the default list delimiter ⏎
\k | List Key-Value Delimiter | insert the default key-value delimiter ≔
\: | List Secondary Delimiter | insert a list secondary delimiter ●
\m | Multi-Value Delimiter | insert the value of the multi-value delimiter
\n | Newline character | insert a newline character
\?xd | Non Standard Delimiters | inserts the non standard delimiters configured in Preferences - Lists - Advanced Settings.
\?ou | Open URL Statement Callback Marker | inserts the marker which is ●
\sp | Space character | insert a space character
\- | Tab character | insert a tab character
\&dddd | UTF16 Character | dddd must be exactly four hexadecimal characters. The value represents a UTF16 character code. eg. \&000d will insert a Carriage Return character. Note that this sequence is not necessary for visible characters as the Mac Character Viewer can be used to insert any visible character
Database Column Sequences |
\|column name| | Insert Column Value | this sequence is only valid while filtering a database. The column value in a row being filtered will be inserted.
Date & Time Sequences |
\yy | Current Year | insert the year
\t | Date & Time | insert the date and time as yyyy-mm-ddThh:mm:ss
\d | Date | insert the date as yyyy-mm-dd
\z | Date & Time.ms | insert the date and time as yyyy-mm-ddThh:mm:ss.###
\%#D | Offset Days before Current Date (YYYY-MM-DD) | # is an optional positive integer value which represents the number of days before the current date. For example: \%32D will return 2016-05-03 if the current date is 2016-06-04. This sequence is case sensitive.
\%#M | Offset Months before Current Month (YYYY-MM) | Note that the M is case sensitive. # is an optional positive integer value which represents the number of months before the current month. Only the year and month components of the date are inserted. For example: \%10M will return 2015-08 if the current date is 2016-06. This sequence is case sensitive.
\%#m | Offset Months before Current Month (YYYY-MM-DD) | The same as \%#M with the exception that the current day is also inserted. For example: \%1m will return 2016-05-04 if the current date is 2016-06-04. This sequence is case sensitive.
\%#Y | Offset Years before Current Year (YYYY) | Note that the Y is case sensitive. # is an optional positive integer value which represents the number of years before the current year. Only the year component of the date is inserted. For example: \%2Y will return 2019 if the current year is 2020. This sequence is case sensitive.
\%#y | Offset Years before Current Year (YYYY-MM-DD) | The same as \#Y with the exception that the current month and day are also inserted. For example: \%1y will return 2015-06-04 if the current date is 2016-06-04. This sequence is case sensitive.
\> | Time Interval | insert the time interval in ms since 1970-01-01T00:00:00
\y4 | Year Field as YYYY | insert the Year field stripping everything off all date components other than a four digit year. Note that formats of YYMMDD without separators are handled correctly. If a value in the range of 1000 to 9999 cannot be established, an empty string is returned
Escape Sequence Control |
\L | Disable Escape Sequence Processing | No further escape sequences are processed in the field. This is useful if you want to insert an arbitrary string which requires backslash characters and you do not want to process Yate sequences. For more information see Delaying & Repeating Escape Processing
\2 | Repeat Escape Processing | Strings containing valid Yate escape sequences can be passed around in track and named variables. When a string is processed which contains track or named variables the content of the variables is inserted. If escape sequences were present in the inserted text they will not be processed. If \2 is processed in a string, the string will be analyzed a second time. Note that regardless of how many \2 sequences are present, the repeating will only be performed once. For more information see Delaying & Repeating Escape Processing.
\b | Sequence Break | a break sequence, nothing is inserted. This can be used to handle the rare case where you have an escape sequence with a trailing # which must be followed by a digit. eg. \v10 implies track variable 10. \v1\b0 implies track variable 1 followed by a 0
Field Values |
\[fldname] | Insert Yate Field | is used to insert the contents of the specified field within a file. eg. fldname can be Artist. If you depress the Shift key while selecting an item on the Insert Yate Field context menu, you will get the raw field name without the escape characters. If the Shift key is depressed prior to displaying the context menu, all fields will be displayed as opposed to those with a value.
\{fldname} | Insert Yate Field (Initial Value) | is used to insert the initial contents of the specified field within a file. Note that an initial field is defined as the value of a field when the file was first loaded or since last saved. If you depress the Shift key while selecting an item on the Insert Yate Field (Initial Value) context menu, you will get the raw field name without the escape characters. If the Shift key is depressed prior to displaying the context menu, all fields will be displayed as opposed to those with a value.
\{<varname] | Initial Value of Field in Named Variable | the specified named variable contains the name of the field whose initial content's are to be inserted.
\+# | Initial Value of Field in Track Variable | the specified track variable contains the name of the field whose initial content's are to be inserted. eg. if Variable 1 contains Artist, \+1 will be replaced with the initial contents of the Artist field
\r | Rating (0-5) | insert the default rating as a value between 0 and 5. This is used to get an external facing value for the rating as opposed to its internal format
\[<varname] | Value of Field in Named Variable | the specified named variable contains the name of the field whose content's are to be inserted.
\=# | Value of Field in Track Variable | the specified track variable contains the name of the field whose content's are to be inserted. eg. if Variable 1 contains Artist, \=1 will be replaced with the contents of the Artist field
IDs |
\u | Unique ID | used to create a unique value as is generated by the Database ID action statement. If you are interested in the type of value generated see Preferences-Actions
\ya | Yate Album ID | insert the Yate Album ID
\yt | Yate Track ID | insert the Yate Track ID
\yi | Yate UID | insert the Preferences-General Yate UID field
Miscellaneous |
\?ft | Finder Tags | The Finder's list of tag colours delimited by the default list delimiter (\~).
\?lv | Log Viewer Content | The current content displayed in the Log Viewer.
\?m3 | m3u File Encoding | ASCII, Latin-1 or UTF-8
\?om | Open Mode | Returns the current open mode. The following characters are used to describe the current setting: A (Album Mode) P (Playlist Mode) + (add to the file list) - (replace the file list) S (process subfolders) X (do not process subfolders).
\?pm | Preserve Mod Date when Saving | The value of the Audio - Preferences - Preserve modification date/time when saving setting. Returns 1 for enabled, otherwise 0.
\?lc | Remaining Lyrics Credits | The total number of remaining lyric credits or empty if the value is not available. Note that the number represents the counts as of the last time the happi.dev API was accessed.
\!propname! | Insert Yate File Property | is used to insert the value of a property within a file named propname. The context menu Insert Yate File Property can be used to insert these sequences
Numeric Exprs/Container Refs |
\?[dirpath\?] | Container Reference | dirpath can be any directed path as described in Directed Paths and may contain escape sequences. Note that the terminating sequence has a leading \ character. This sequence is effectively an Extract Data from Container statement with the include data tag option not enabled. Errors are not reported. Any error will result in nothing being inserted and the error text will be in named variable Container Error.
\x(expression\x.) | Numeric Expression | expression can be any expression as defined in the Evaluate Expression statement and may contain escape sequences. Note that the terminating sequence has a leading \ character. If the expression cannot be compiled a message will be posted and the action will be terminated at the start of the next statement or earlier. If the expression results in an invalid number or in the case of division by zero, nothing is inserted. If the expression evaluation works, the inserted text may or may not contain a fractional component.
\x(expression\x) | Numeric Expression (integer) | expression can be any expression as defined in the Evaluate Expression statement and may contain escape sequences. Note that the terminating sequence has a leading \ character. If the expression cannot be compiled a message will be posted and the action will be terminated at the start of the next statement or earlier. If the expression results in an invalid number or in the case of division by zero, nothing is inserted. If the expression evaluation works, the inserted text will always be an integer value.
Paths |
\?as | Application Support Directory | insert the path to the ~/Library/Application Support directory
\?td | Default Track Database | Insert the path to the default track database optionally specified in Preferences - Databases
\?do | Documents Directory | insert the path to the Documents directory
\?DL | Downloads Directory | insert the path to the Downloads directory
\h | Home Directory | insert the path to the home directory
\?mo | Movies Directory | insert the path to the Movies directory
\?mu | Music Directory | insert the path to the Music directory
\?ys | Yate Application Support Directory | insert the path to the ~/Library/Application Support/Yate directory
UDTIs |
\^UDTIname^ | User Defined Text Info Item | is used to insert the value of a UDTI. If the UDTI does not exist, nothing will be inserted. Note that due to the implementation, this sequence will work even if the UDTI is mapped to a custom field. The Insert Common UDTI context menu can be used to quickly insert common UDTI names
\^<varname^ | User Defined Text Info Item in Named Variable | the specified named variable contains the name of a UDTI whose content's are to be inserted. eg. if named variable udti contains MyData, \^<udti^ will be replaced with the contents of a UDTI named MyData. If the item does not exist, the sequence is ignored
\*# | User Defined Text Info Item in Track Variable | the specified track variable contains the name a UDTI whose content's are to be inserted. eg. if Variable 1 contains MyData, \*1 will be replaced with the contents of a UDTI named MyData. If the item does not exist, the sequence is ignored
Variables |
\<varname> | Insert Named Variable | inserts the contents of the named variable varname. If the named variable does not exist, it is considered to be empty. The context menu Insert Special Yate Named Variable can be used to insert special named variables set by the application. If you need the non escaped name of a special named variable, depress the Shift key when selecting the item. You would do this when an action statement requires the name as opposed to the contents of a named variable. The Insert Named Variable context menu contains all named variables directly referenced in text fields in all open actions. The Shift key functionality applies to this menu as well
\@# | Named Variable in Track Variable | insert the contents of the named Variable whose name is contained in the specified track variable. eg. if Variable 1 contains test, @1 will be replaced with the contents of named variable test
\@<varname> | Named Variable in Named Variable | the named variable varname contains the name of the named variable to be inserted
\v# | Track Variable | insert the contents of the track variable
\i# | Track Variable as Integer | insert the contents of the specified track variable as an integer value. The leading integer value in the track variable will be returned. If there is no leading integer value, 0 will be returned. eg. 5th movement --> 5
\f# | Track Variable as Float | insert the contents of the specified track variable as a numeric value. The leading number in the track variable will be returned with at least one non fractional digit and at least one fractional digit. If there is no leading number, 0.0 will be returned. eg. 22.52, text --> 22.52
\s# | System Variable | insert the contents of the specified System Variable
Version Strings |
\?iv | iTunes Version string | insert the iTunes version string or ? if it is unavailable
\?os | Mac OS Version string | insert the Mac OS version string
\?mv | Music Version string | insert the Music version string or ? if it is unavailable
\?tv | TV Version string | insert the TV version string or ? if it is unavailable
\?yv | Yate Version string | insert the Yate version string
Other Sequences |
\char |  | where char is any character other than those defined above as following a \, will not be modified. eg. \z is equivalent to z. As additional escape sequences can be added at any time, this form is not recommended.

# Submenus Available in Action Text Fields

Insert Yate Escape Sequence
  This menu has items to insert all of the valid escape sequences. The menu contains grouping submenus.
Insert Yate Field
  This menu inserts the escaped name of a Yate field. If the Shift key is pressed, the unescaped name will be inserted.
Insert Yate Field (Initial Value)
  This menu inserts the escaped name of a Yate field when a file was first loaded or last saved. If the Shift key is pressed, the unescaped name will be inserted.
Insert Yate File Property
  This menu can insert most of the properties available on the Get Property statement. The name of the property will be properly escaped. If you want the unescaped name, hold doen the Shift key when inserting.
Insert Special Yate Named Variable
  This menu contains the names of all named variables directly set by Yate. ie. not user defined. This menu is contextually aware of the intent of a field. When inserting to a field which should contain the name of a named variable, the inserted contents will not be escaped. When the field specifies a value, the inserted contents will be escaped. You can flip the interpretation of the inserted contents while holding down the Shift key.
Insert Common UDTI
  This menu contains the names of all UDTIs directly set by Yate. ie. not user defined. This menu is contextually aware of the intent of a field. When inserting to a field which should contain the name of a UDTI, the inserted contents will not be escaped. When the field specifies a value, the inserted contents will be escaped. You can flip the interpretation of the inserted contents while holding down the Shift key.
Insert Runtime Setting
  This menu contains the names of all action run time settings which are referenced in any open action or are already defined. This menu is contextually aware of the intent of a field. When inserting to a field which should contain the name of an action runtime setting, the inserted contents will not be escaped. When the field specifies a value, the inserted contents will be escaped. You can flip the interpretation of the inserted contents while holding down the Shift key.
Insert Named Variable
  This menu contains the names of all named variables which are used in any open action. This menu is contextually aware of the intent of a field. When inserting to a field which should contain the name of a named variable, the inserted contents will not be escaped. When the field specifies a value, the inserted contents will be escaped. You can flip the interpretation of the inserted contents while holding down the Shift key.
Insert Query Database Prefix
  This menu contains the names of all referenced query database prefixes. This menu is only displayed where it is relevant.
Insert Container
  This menu contains the names of all referenced containers. This menu is only displayed where it is relevant.