Simple ZPL print statements not appearing anywhere
I’m trying to run a simple macro to test printing to screen:
PRINT “Hello world”
When I run this, all that appears is a text viewer saying “Executing path/to/macro...” and nothing else. I tried adding OUTPUT SCREEN before the print statement to make sure the statement prints to screen, but same issue.
Any advice?
Page 1 / 1
@Ryan.Burdick
I think it has to do with your quotation marks.
You are using opening and closing double quotation marks. Can you notice how they are different at the beginning and end of the string? These correspond to characters 147 and 148 (in decimal) of the ASCII table. Instead, you should only be using character 34 (in decimal) of the ASCII table for both the beginning and end of the string. This is what it should look like:
Notice how the string turned purple? That’s a confirmation that OpticStudio understood this was a string, and therefore is printable.
And here is the line of code copied for your reference with the right quotation marks:
PRINT "Hello world"
You should be able to find this character on your keyboard, of course it’ll depend on your language settings. In your profile, you indicated that you are based in the US. On a US keyboard layout, I’ve highlighted the key below, since you want the double quotation mark, you probably have to hold SHIFT+this key (not totally sure, I’m not using a US layout):
Worst case scenario, you can get this character on Windows by holding the ALT key down and pressing 0034.
I hope this helps and take care,
David
My script uses the quotation marks you specify as being correct. The string is purple. Oddly enough, when I run the macro today, the text viewer now prints “Hello world” as expected. I haven’t changed anything to the macro since I last tried running it.
I did open a different Zemax file to work from this time. I’m not sure what that can have to do with it, but it’s the only difference between me running the macro today vs last week.