Hi Isaiah,
I did test in 20.1 and can confirm that the method should work there.
Actually, it looks like my code was re-formatted a bit. Whenever we declare a string, it should be surrounded in quotation marks. When I pasted the code here, the quotation marks were switched to apostrophes . Sorry about that! Here is the code as I see it in OpticStudio:
Actually, I just tried to run your code. I think I found the problem! When we run a macro through the command line in the way I presented above, OpticStudio is opened with a blank lens file and then the macro is run. As your code is now, the OUTPUT keyword is within an IF statment which is searching for a MIRROR surface. A blank lens file will not have a MIRROR surface, so everything within the IF statement will be ignored.
When we use the OUTPUT keyword on line 13 (with the correct formatting), then the file will be created as expected, but it will be blank.
As a test, add a LOADLENS command to the top of your macro so that the lens file of interest is opened with the macro! Let me know how that works!
Best,
Allie