Macro Language Reference > PIs > Text > <?macro>
  
<?macro>
Description
Any macro can be called from a Perl script by using this command.
 
Example 478. Call an APP macro from a Perl script
To call the refresh (trf) macro in a Perl script, use the following syntax:
macro 'trf';
 
Example 479. Call an PTC ALD macro containing double quotes from Perl
The macro function takes a single string which is passed to the PTC ALD processor for execution.  Therefore, when calling a macro that refers to information in double quote delimiters, for example tf "times", it is convenient to use the macro function with Perl's 'q' or 'qq' operators.
The example below calls the insert (@) macro and inserts the text 'Insert this Text' at the current cursor position:
macro q(@Insert this Text);
This example uses the ttagmk command to create a new text stream called 'new':
macro q(ttagmk 'new.tx');
If the function involves a variable, use the 'qq' function to insert embedded variables. For instance, the following syntax creates a tag with the value of the variable tagname:
qq(ttagmk '$tagname');
Syntax
<?macro perl script:s>
macro
Specifies the PTC ALD macro to call.
For more information. see Reference Chapter: Perl in PTC ALD.
Related Links