The easiest way to understand communication between your program (referred to as the client in this article) and ZEMAX (called the server in this article) is as a conversation between the two programs. The client sends a string to the server, the server acts upon the contents of the string and returns another string.

The string sent by the client is called a data item. An example of a data item is the string "GetName" which tells ZEMAX to get the name of the current file in memory. For example, if you load the sample file {zemaxroot}/samples/sequential/objectives/Cooke 40 degree field.zmx, you will see that it has the title "A simple cooke triplet" :

 
ZEMAX ships with a sample Extension program called "Command Line Interface" which you can find under the "Extensions" menu. If you run this and type GetName, you will see:



The Command Line Interface program is a simple utility written in Visual Basic. Full source code is provided, in the {zemaxroot}/extend/Visual Basic sample folder. But the principle is clear: you send a command (a data item) and ZEMAX gives a response. The Extensions chapter of the ZEMAX manual gives full details of all data items and their responses.