What is a .pcf file?
A .pcf file is a text file that contains a series of commands that PrestoPlot can automatically execute.
These commands allow scripting of chart creation and image generation, which can then be dynamically integrated into reports.
How to create a .pcf file?
The simplest way to create a .pcf file is to use the recording feature in PrestoPlot:
- Recording actions: PrestoPlot records most user actions (such as opening files, creating charts, or using the calculator) in a "log window".
- File generation: A button named Create PCF from log allows you to automatically build the .pcf command file from the actions recorded in this log.
- Saving: When you save this file, for example naming it my_macro, the
.pcfextension is added automatically.
Not all actions are recorded in the log. For example, specific curve settings (such as thickness or color) are not included.
What does a .pcf file contain?
A .pcf file contains a list of commands that reproduce user actions (see all available commands).
Here are some examples of actions that can be scripted:
- Load data files, using either absolute or relative file paths.
- Create new variables using the integrated calculator.
- Create charts, add titles, and rename them.
- Export charts as images (e.g., in PNG format), optionally specifying format and size.
- Save charts in PrestoPlot format (
.pgr).
How to run a .pcf file?
There are several ways to execute a .pcf macro:
- From the PrestoPlot interface:
- Using the PCF icon.
- With the F5 keyboard shortcut.
-
By simply dragging and dropping the
.pcffile into the PrestoPlot window. -
From the command line: A .pcf file can be executed directly from a command line, which is very useful for process automation.
-
File association: It is possible to associate the
.pcfextension with the PrestoPlot executable. Once this association is made, double-clicking on a.pcffile will launch PrestoPlot (if not already open) and execute the commands it contains.
Example of a .pcf file
# Load in a set of data from the POM packet
-load "D:/USERS/Presto/PrestoDecom/Resultats/POM_2003_06_16_10_12_59_Decom.tsv"
# Draw a graph from the loaded data
-loadmodel "D:/USERS/Presto/PrestoPlot/Saved/Pom.pmd"
# Save the graph as a gif image file
-savegif "D:/USERS/Presto/PrestoPlot/Saved/Pom.gif"
# Delete the graph
-closegraph LAST
# Delete the loaded data
-deletedata "IBAT VBAT"