Contents - Index


$RunMacroAfter 

 

The $RunMacroAfter provides an easy way to embed macro commands within the Equations window, as an option to using the Macro window to play the macro commands.  There are a large number of macro commands that can be used to automatically produce plots, export data, start programs or other activities.  As implied in its name, the $RunMacroAfter directive will play the specified macro commands after the calculations have been completed.  The directive can be used with the Solve, MinMax and Uncertainty Propagation commands and their related commands that use the Parametric table.  If the Parametric table is involved, the $RunMacroAfter will start operation after calculations for all of the rows in the Parametric table have completed unless a /A option is provided.  In this case, the macro will execute after each run in the Parametric table is completed.

 

There are two formats for the $RunMacroAfter directive.  The first format requires the name on the tab of an existing macro file in the Macro Window or the complete name of an external macro file (having an .emf file name extension) to be provided directly following the $RunMacroAfter keyword, .e.g,

 

$RunMacroAfter  'Macro 1'

 

or 

 

$RunMacroAfter 'C:\Temp\MyMacro.emf'

 

 

The second format provides the macro commands in the Equations window between the $RunMacroAfter directive and a required $EndMacro directive, e.g.,

 

$UnitSystem SI C kPa kJ mass

P1=6000 [kPa]

P2=4000

P3=2000

P4=1000

v1=1 [m^3/kg]

v2=5

 

$RunMacroAfter

DeletePlot 1

PropPlot Steam TS 4 P1 P2 P3 P4  2 v1  v2 DoQLines

$EndMacro

 

Note that this macro uses variables defined in the EES program to specify lines of constant pressure and volume in an automatically generated property plot.  There are many other ways in which the $RunMacroAfter directive can be employed.

 

One use for the $RunMacroAfter /A command is to set values or strings in the Parametric table that will be used in future runs, based on the values in the current run.  For example, suppose your program calculates Mode$, a string variable that you wish to use in the next run.  A column for Mode$ exists in the Parametric table.  The following statements will set Mode$ for the next run.

 

$RunMacroAfter /A

Run1=TableRun#+1

Parametric['Table 1',Run1,'Mode$']=Mode$

$EndMacro

 

 

See also: Macro Commands

 Create Macro

 $RunMacroBefore  

 

 

Directives