|
| |
Macros are simply text files containing StampPlot
instructions. Macros may be used for:
 | Plot configuration including plot objects |
 | Event handling |
 | Data processing |
 | Libraries to be called from the micro or other macros. |
Macros are text files with an extension of .spm for
version 3, or .txt for version 1 and 2. The Start-Up Macro
is the macro specified to be ran when StampPlot is loaded.
Macros may be written manually in a text editor, such as
Windows (TM) NotePad, or by use of the Macro Editor which creates a macro from the
current configuration (Pro-licensed required).

 | Simple Macro:
To create a simple macro, use the Macros menu--> Edit Macro with
NotePad
 | Enter a macro name, such as "Macro Test",
answer yes to both questions asking if the file should be created. |
 | Copy and paste the following code:
INIT:
' Clear any plot objects
!POBJ Clear
' Start a new Plot
!NEWP
' Title the plot
!TITL A test of Macros
' Configure for -100 to 100 on Y axis:
!SPAN -100,100
' Set X axis to real time mode
!RTIM ON
' Set background (B) color to black, grid (G) to yellow and scales (S)
to red
!COLR B(BLACK) G(YELLOW) S(RED)
'Enable Plotting
!PLOT ON
ENDMAC
|
 | Save the text file. |
 | From the Macros menu--> Run Macro,
Ensure the name you entered is shown and click OK. |
 | The macro placed in the Queue and processed. |
|

Note that comments must be on a separate line from the
instructions and are identified with an apostrophe.
While macros routines can be a very useful tool, the use
of Plot Objects can be used to replace much of their use.
 | Macro Routines
A Macro may contain multiple routines which may be called
independently. The basic structure of a macro routine is:
Routine_Name:
instructions
.
.
ENDMAC
When a macro is opened without specifying a routine name, the 1st routine,
commonly named INIT, will be processed.
|
 | Calling Macros and Routines
 | A macro my be ran through the menu as above, or called
from code from the micro or from a macro or object. Note that the
extension is omitted (.spm or .txt).
!MACR macro_name
!MACR Macro Test
DEBUG "!MACR Macro Test",CR
|
 | To call a specific routine within a macro:
!MACR macro_name.routine_name
or, if calling within the same macro,
!MACR .routine_name
|
 | Unless a path is specified, a macro is assumed to
reside in the Macro directory of StampPlot.
To call a macro in a sub directory of StampPlot's Macro directory:
!MACR subdirectory\macroname
!MACR spp_pobj\X-YPlot
To call a macro outside of the StampPlot Macro directory:
!MACR drive:\directory\name
!MACR c:\my documents\My_Macro
|
|
 | Passing data to a macro
Data may be passed to a macro for processing. This is useful for
library macros which may required data.
!MACR macro_name.routine_name,value, value
Data will be parsed into data markers beginning at %m0.
!MACR My_macro.Add,1,2,3
To specify another data marker to begin parsing at:
!MACR macro_name.routine_name%marker_value,value,value
!MACR My_macro.Add%90,1,2,3
|
 | Example using routines.
Create a new macro, copy & paste, save and run.
INIT:
' clear plot object
!POBJ Clear
' New plot
!NEWP
'Call routine for setting span
!MACR .SPAN
ENDMAC
SPAN:
' request min scale, 0 default,10 second wait, store into %m10
!MREQ 0,20,Plot minimum scale?,10
' request max scale, 500 default,10 second wait, store into %m11
!MREQ 500,20,Plot maximum scale?,11
!SPAN %m10,%m11
ENDMAC
|
 | Macros extended with .spm, may also be ran as an
associated file by double-clicking the file in Windows Explorer or directly
from a webpage.
|
 | Macros may also respond to events and process incoming
data. Please see Macros-Default and Events. |
|