Substitution Macros

Previous pageReturn to chapter overviewNext page

 

Some GExperts tools such as the Macro Templates editor expert and the Backup Project expert can use substitution macros in their configuration.  These macros allow various %-delimited phrases to be dynamically replaced with a context-sensitive string. The supported macros are:

 

Project/Unit:

%PROJECTNAME%

The project name

%PROJECTDIR%

The project directory

%PROJECTGROUPNAME%

The project group name

%PROJECTGROUPDIR%

The project group directory

%UNIT%

The current unit name

%UNITDIR%

The unit directory

 

Date/Time:

%DATE%

The system format date

%DATETIME%

The system format date/time

%YEAR%

The year, in four digits

%MONTH%

The month in two digits

%MONTHSHORTNAME%

The short month name

%MONTHLONGNAME%

The long month name

%DAY%

The day in two digit format

%DAYSHORTNAME%

The short day name

%DAYLONGNAME%

The long day name

%HOUR%

Hour in two-digit format

%MINUTE%

Minute in two-digit format

%SECOND%

Second in two-digit format

 

System:

%USER%

The currently logged in username

%CLIPBOARD%

The text contents of the clipboard

%SELECTION%

Selected text in the current IDE editor.  For the macro templates, the selection text will be deleted from the editor and moved to the position specified by this macro.

%COPYSELECTION%

Selected text in the current IDE editor. For the macro templates, the selection is not deleted from the editor but instead is copied into the macro.

%INPUTVAR%

Queries the user for a string when executed.  The format of this macro is: "%INPUTVAR,VarName,<caption>%", where the dialog caption is optional.  For example: "%INPUTVAR,VarName,Enter a value%".  After the user has input the desired value, the value may be used as a macro later as %VarName%.

 

Version Information (requires version information in the IDE project options):

%VERPRODUCTVERSION%

The project product version

%VERFILEVERSION%

The project file version

%VERMAJOR%

The project major version

%VERMINOR%

The project minor version

%VERRELEASE%

The project release version

%VERBUILD%

The project build version

%VERPRODUCTNAME%

The project product name

%VERINTERNALNAME%

The project internal name

%VERFILEDESCRIPTION%

The project file description

 

Source Code Parsing (Delphi source only):

%IDENT%

The identifier under the editor cursor (works for C++)

%PROCNAME%

The name of the procedure after/before the cursor

%RESULT%

The result of the procedure after/before the cursor

%ARGUMENTS%

The arguments of the procedure after/before the cursor (all on one line)

%METHODCLASS%

The class and method name in the format "Class.Method" for the procedure after/before the cursor

%CLASS%

The class name after/before the cursor (searches declarations and method definitions)

%INTERFACE%

The interface name after/before the cursor

%BEFORE%

Toggles the state of looking after/before the cursor position for macro substitutions like PROCNAME, RESULT, etc.  The default is to look after the cursor.

%BEGINPARAMLIST%

%ENDPARAMLIST%

Starts and ends a section of the substitution where the appearance of any of the three below macros reports on only a single argument of the method before/after the cursor.  This allows creating macros with an argument per line.

%PARAMNAME%

The name of a single argument (use after %BEGINPARAMLIST%)

%PARAMTYPE%

The type of a single argument (use after %BEGINPARAMLIST%)

%PARAMDEF%

The default value of a single argument (use after %BEGINPARAMLIST%)

 

For Macro Templates Only (configured inside Macro Templates):

%PROGRAMMERNAME%

Full name of the user

%PROGRAMMERINITIALS%

Initials of the user

%PGEN%

An auto-incremented integer sequence number

 

Note: To produce a literal percent (%) character in the output, type it as two consecutive percent characters (%%) to prevent an attempt to parse the percent as the start of a macro.

 

Examples

Examples of many of these macros can be seen by looking at the default macro templates accessed via GExperts, Configuration, Editor Experts, Expand Macro Template, Configuration.