Currently the Fourier Analysis feature of the PLECS Scope is not accessible via simulation scripts.
One approach to access the Fourier spectrum in simulation is to use the Fourier Transform block from the PLECS library. The output of the Fourier Transform block can then be accessed via a simulation script using a Signal Outport on the top level schematic. Then, one can iterate through different configurations in a Configurable Subsystem to evaluate different topologies. Additionally, as of PLECS 4.4 users have the ability to generate Octave plots from PLECS simulation scripts.
Attached is an example model. The model includes a script to generate the figure below. The script is accessible from the Simulation + Simulation Scripts drop-down menu. In this case the harmonics waveforms are generated as a sum of sinusoids, but naturally this can be expanded upon.
Alternatively, you could use a similar script and the To File block from the PLECS library and post process the data in another tool.