Metacommands

Multi-Edit Metacommands are special character sequences that allow the user to express certain data in command lines, prompts, and configuration options that would otherwise be difficult, if not impossible to enter literally. One of the most common uses for Metacommands is embedding them in a compiler command line. Below is a list of all of the supported Metacommands classified into groups by where they can be accessed.

In addition to the general command line Metacommands, which can be used anywhere Metacommands are supported, there are special Metacommands for printing, templates, help file support, VCS support, program execution, and the search dialogs. There are also error-parsing routines that use special metacommands called Regular Expression Aliases.

Long Filename Metacommands

Two metacommands provide long filename support. Neither of these metacommands actually expands to anything (unlike the <FILE> metacommand). Instead, they act as “flags” to the various parts of Multi-Edit that call them. When using these metacommands, you should ensure that any external application you are calling supports long filenames (or short filenames, as may be the case). If, for some reason, you want to change filename schemes in the middle of your command line, you can do so by specifying a different filename metacommand in the middle of the command line.

The Long Filename Support Table:

^Metacommand ^Function^

<SFN> Stands for Short File Name. When this metacommand is inserted, all file and pathname metacommands following it will be expanded in SHORT name format. It is also the default metacommand (i.e. filenames expand in short form by default).
<LFN> Stands for Long File Name. The <LFN> metacommand causes all file and pathname metacommands following it to expand in LONG format. Example: <LFN>D:\PROGRAMS\SOMEPROG.EXE -F<FILE>.<EXT> -A -B -C… etc

General Command Line Metacommands

The general command line Metacommands are expanded by the MeTools^TranslateCmdline macro and any Metacommand that it does not recognize will remain intact on exit. This macro is usually called by the other Metacommand translate macros after they have expanded the ones they recognize.

General Command Line Support

Metacommand Function
<@macro> Substitutes the string in Return_Str after running the macro specified by “macro”.
<%var> Substitutes the value of the DOS environment variable “var”.
<~str> Substitutes the value of the global variable “str”. The global variable can be either a string or integer variable where the integer value will be written as a string. For example, <~!HELP_PATH> would insert the value of Global_Str('!HELP_PATH') into the prompt or option.
<FILE> Substitutes the current window's file name minus an extension.
<EXT> Substitutes the current window's file extension.
<NAME> Substitutes the current window's file name minus the extension and path.
<PATH> Substitutes the current window's path.
<ME_PATH> Substitutes the path where Multi-Edit resides.
<USER_PATH> Substitutes the path where the user specific configuration files reside. If not network version, defaults to the “config directory”.
<MAC_PATH> Substitutes the path to the current user's directory.
<DEFAULTS_PATH> Substitutes the path where default templates and configuration items are kept.
<USER_ID> Substitutes the current User Id. Only applicable to the Network version. See NETWORK SUPPORT for more details.
<COMSPEC> Substitutes the current command processor (command.com).
<CTIME> Substitutes the current time. The <CTime> Metacommands allow for passing an optional format string. To specify a format string, use the following format. <CTime format string> Examples: <CTIME HH':'mm> would insert the time as 15:07 See table below for all of the valid format string values.
<CDATE> Substitutes the current date. The <CDate> Metacommands allow for passing an optional format string. To specify a format string, use the following format. <CDate format string> Examples: <CDATE dd'-'MMM'-'yy> would insert the date as 27-Jan-99 See table below for all of the valid format string values.
<FTIME> Substitutes the last file save time.
<FDATE> Substitutes the last file save date.
<PROJECT> Substitutes the current project file's name minus the extension and path.
<PROJECT_FILE> Substitutes the current project file's name.
<PROJECT_FILEPATH> Substitutes the current project file's path.
<PROJECT_ROOT> Substitutes the root path for the current project.
<PROJECT_LIST> Substitutes the name of a file that contains a list of the filenames in the current project.

<CDate> and <CTime> Format String Values

Format String Function
d Day of month as digits with no leading zero for single-digit days.
dd Day of month as digits with leading zero for single-digit days
ddd Day of week as a three-letter abbreviation. The function uses the LOCALE_SABBREVDAYNAME value associated with the specified locale.
dddd Day of week as its full name. The function uses the LOCALE_SDAYNAME value associated with the specified locale.
M Month as digits with no leading zero for single-digit months.
MM Month as digits with leading zero for single-digit months.
MMM Month as a three-letter abbreviation. The function uses the LOCALE_SABBREVMONTHNAME value associated with the specified locale.
MMMM Month as its full name. The function uses the LOCALE_SMONTHNAME value associated with the specified locale.
y Year as last two digits, but with no leading zero for years less than 10.
yy Year as last two digits, but with leading zero for years less than 10.
yyyy Year represented by full four digits
gg Period/era string. The function uses the CAL_SERASTRING value associated with the specified locale. This element is ignored if the date to be formatted does not have an associated era or period string.
h Hours with no leading zero for single-digit hours; 12-hour clock
hh Hours with leading zero for single-digit hours; 12-hour clock
H Hours with no leading zero for single-digit hours; 24-hour clock
HH Hours with leading zero for single-digit hours; 24-hour clock
m Minutes with no leading zero for single-digit minutes
mm Minutes with leading zero for single-digit minutes
s Seconds with no leading zero for single-digit seconds
ss Seconds with leading zero for single-digit seconds
T One character time marker string, such as A or P
tt Multicharacter time marker string, such as AM or PM

Execute Program Metacommands

The following Metacommands allow specifying the exe type of a program on the command line so that the ExecProg macro can be notified how the program is to be launched. These can be placed anywhere in the command line but the best place to use these would be just before the first parameter of the command line.

Execute Program Support

Metacommand Function
<XDOS> Force command line to be run as a Dos program (Uses DosExec)
<XOS2> Force command line to be run as an OS/2 program (Uses Os2Exec)
<XW16> Force command line to be run as a 16-bit Windows program. (Run directly)
<XW32> Force command line to be run as a 32-bit Windows program (Run directly)
<XW32C> Force command line to be run as a Win32 Console program (Uses W32Exec)
<XMAC> Force command line to be run as a macro.
Example:
    Get command for PVCS
    GET.EXE <XDOS>-L <LPATHX>(<NAME>.<EXT>)

Printing Metacommands

The following are valid only for printing. Used for headers and footers set up.

Printing Support

Metacommand Function
<LM> Pushes all following text to left margin
<CM> Centers the following text
<RM> Right justifies following text
<PAGE> Substitutes current page number

Compiler Metacommands

These Metacommands are only valid in a compiler command line via the compiler run dialog and are expanded directly by the Compile^CompileEx macro.

Compiler Support

Metacommand Function
<MEERR> This will substitute the name of the file used to capture the compiler screen output (stdout/stderr), which is a unique temporary filename. If you are using a compiler command line or a batch file that has MEERR.TMP in it, you should convert over to using <MEERR> instead. In the case of batch files, you'll probably have to add <MEERR> to the end of the command line that runs the batch file, then change the occurrences of MEERR.TMP in the file to %x (x being the next available parameter number).
<NR> This does not do a substitution but will set the options to not capture any output (stdout/stderr).
<TESTERR> This is a special Metacommand that is used for testing purposes. When this Metacommand appears on the command line the compile macro will not launch any program but rather open a CmpError.db file which contains error samples, search it for a page matching the program type, mark and paste this into the output window and then start the error processing macro. We use this to test the error processing regular expression data for compilers that we do not have access to.

VCS Metacommands

These Metacommands are specific to the VCS support and a few are for specific VCS programs.

VCS Support

Metacommand Function
<LOOKUP> Substitutes the archive path looked up in the associate directory database.
<CFGFILE> Substitutes the archive path looked up in the specific VCS package config file. Currently the same as <LOOKUP>
<LPATHX> Substitutes the derived library path minus an ending “\”.
<LPATH> Substitutes the derived library path.
<OPATH> Substitutes the current window's path minus drive letter.
<COMNT> Substitutes the filename of the file containing the VCS comment.
<%TMP> Substitutes the value of DOS environment variable “TMP” with an ending “\”.
<TMP_PATH> Substitutes the value of Multi-Edit temporary file path variable ”@TMP_FILE_PATH”.
<TMP_PATHX> Substitutes the value of Multi-Edit temporary file path variable ”@TMP_FILE_PATH” minus an ending “\”.

CVS Support

Metacommand Function
<CVSDIR> Substitute the value of the environment variable “CVSDIR”

RCS Support

Metacommand Function
<RCSDIR> Substitutes the value of the DOS environment variable “RCSDIR”.

SAP Support

^Metacommand ^Function^

<SAPCMT> Substitutes the Sourcerer's Apprentice command ”-c comment”.

Help File Metacommands

These Metacommands are used in the Help Viewers Setup dialog to specify help files and options to be passed to the Help macro.

Help File Support

Metacommand Function
<HFILE> Substitutes the name of the specified Help file without extension.
<HEXT> Substitutes the extension of the specified Help file.
<HNAME> Substitutes the name of the specified Help file without path or extension.
<HPATH> Substitutes the path of the specified Help file without extension.
<HOPTS> Substitutes the options, usually a help index, for the current context sensitive help call.
<HTMLHELP> Substitutes the command line to run to invoke the HtmlHelp program.
<WINHELP>

Template Metacommands

These Metacommands can only be used in templates.

Template Support

Metacommand Function
<-?> This metacommand expands to a matching begin/end comment, with a ? in the middle that you can fill in later.
<-SPACE> Inserts a space for use at end of line.
<-TAB> This will have the effect of pressing the tab key.
<-UP> Move the cursor up.
<-CUR> This will indicate where you want the cursor to end up after expansion is completed.
<-CR> Line break. This is only needed if you wish to insert a carriage return at the end of your template result. Otherwise you can simply break a line in the result field within your template.
<-SMARTIND+> Any line breaks in the result that follow this command will invoke the smart indent macro rather than simple carriage returns.
<-SMARTIND-> This turns off the above metacommand.
<-SCUR> This saves the cursor position at the point of insertion for later restoring.
<-RCUR> If used after a <-SCUR> metacommand, will restore the cursor position.
<-XCUR> Exchange the current cursor position with the last <-SCUR> saved position and then move the cursor to the original saved position.
<-SIND> Save the old indent level and then set the indent level to the first word on the current line. (Used for nested code templates).
<-SCIND> Save the old indent level and set the indent level to the current cursor position. (Used for nested code templates).
<-RIND> Restore the indent level saved by <-SIND> and <-SCIND>.
<-PROMPT> Will invoke a prompt during a template expansion whose result will be inserted in the result in this position. Multiple prompts are supported as well as specifying a default value. Examples: <-Prompt> <-Prompt~1 Enter name`Dan>
<-LASTPROMPT> If used after a <-Prompt> metacommand, it can be used to redundantly insert the value of the prompt without having to be prompted again. Examples: <-LastPrompt> <-LastPrompt~1>
<-GETBLOCK> This metacommand will cut a marked block to buffer 52 if the cursor is in the block.
<-PUTBLOCK> This metacommand will paste a block cut by the <-GetBlock> metacommand.
<-TEXT str> Insert “str” exactly as entered.
<-nnn> Character in decimal (0-255). This is useful for entering “non-typeable” characters.
<-0xHH> Character in hex (0-FF). Same as above but uses hex numbers instead of decimal numbers.
<!macro> Runs the macro specified. For example, to run the macro Sp_Setup in the macro file mymacs, the metacommand would be <!MyMacs^Sp_Setup>. Regular parameters can be passed using this method, i.e. <!MyMacs^Sp_Setup /PARM1=something/PARM2=something else>

Not all prompts and configuration options, etc. support Metacommands. Check the documentation for each prompt, etc. to see if it supports Metacommands.

 
doc/manual2k8/metacommands.txt · Last modified: 2008/07/09 14:53 (external edit)     Back to top