ZPL Macro syntax highlighting using Notepad++

Using macros, written in the Zemax Programming Language (ZPL), is a powerful way to extend the functionality of ZEMAX. Zemax doesn’t provide a special editor for writing ZPL macros, and it recommends using text editors such as the NOTEPAD editor.

I love editors with syntax highlighting. Since there are no standard editors (with syntax highlighting) for writing ZPL codes, I decided to use Notepad++. It also allowed me to create a style-file which enabled syntax highlighting and support minimal code folding as shown below. The style-file contains the latest keyword, numeric function and string function definitions (as of April 2013). I have shared the style-files here in the post.

In order to download the files and see the quick instructions to use them, please continue reading.


Today (05/06/2014) I got to know about another project, created by Xinda Hu, for syntax highlighting and code folding of macro programs for both Zemax and Code V. It seems to be quite sophisticated and uses a modified form of Solarized theme. It also provides auto-complete and function calltips in the editor, which I believe can be of great help while coding. He has uploaded the required files at his GibHub page here (Zemax) and here (Code V). He has also created a GIF animation to demo the capability of his highlighter project, which can be found here. I highly recommend using his project for ZPL syntax highlighting.

Continue reading