## Macro

Macros are some predefined strings that can be embedded in any string based properties such as "PV Name", "Text", "Tooltip", "Scripts" and so on. Macro will be replaced with its string value at Runtime.

### Format

The macro format can be either $(macro_name) or ${macro_name}

There are two types of macros:

### Predefined Symbol Macro

Symbol Macros can be defined in several places as listed below. If a same macro is defined in multiple places and the option `Include macros from parent` in Macros property is selected, it will be overriden in the order as below. For example, macros defined in Display's Macro property will override the macros defined in Open OPI Actions, and macros defined in Open OPI Actions will override the macros defined in BOY Preferences.

1. BOY Runtime Preferences
   BOY runtime preference can be opened from menu: `CSS->Preferences...->CSS Applications->Display->BOY->OPI Runtime`
2. Open OPI Actions
   It includes open OPI from actions, open OPI from command line and open OPI from top OPIs button.
3. Display
   Defined in the `Macros` property of Display.
4. Contianer
   Defined in the `Macros` property of container widget, such as Grouping Container, Linking Container and Tabbed Container.

Attention: Macro name only allows letters and numbers (should not start with number).

### Widget Property Value Macro

This allows you access the value of a property of the widget in run mode. In this case, the macro_name is the property id of the widget property. For example, $(pv_name), $(pv_value), $(forground_color)...
A good example of Widget Property Value Macro is the tooltip: A tooltip of "$(pv_name)$(pv_value)" will display the PV Name and its value in run mode.

### System Macros

These macros are predefined in BOY. They can be overriden by Symbol Macros. Here are two macros available:

- `$(DID)`: The unique ID for each display. Even if there are multiple displays refering tho the same OPI file, each display still has an unique ID. This macro is useful for avoiding name conflict. For example, if we add a prefix of `$(DID)_` to a local PV name, we can easily guarantee the PV name is unique to this display.

- `$(DNAME)`: The name of the display.