Edit: thewoodenradio and I cross posted. His approach will work if you only want to know if the macro was ever run before - it's a Boolean test if the macro has been run in the past. The approach I describe below allows you to determine if a different version of the macro was run before, which is how I understood your request:
You can save a file to to the user's hard drive with the macro version number, then check the contents of that file. MACSETTINGS is one way to do this, and probably the easiest. Here is sample code that will do what you need:
Run this code once, then edit the macro to increase the MacVersion number and run it again to see how it works.
Caveats:
1) You must have a properly formatted GSAK Macro Header in your macro.
2) You must use straightforward version numbering - i.e. use 1.0, 1.1, 1.2, not "2.3.7B 12-31-13 Mountain Lion".
QUOTE (etzh) |
I would like it to clear all of the fields the first time a new version of the macro is run. |
You can save a file to to the user's hard drive with the macro version number, then check the contents of that file. MACSETTINGS is one way to do this, and probably the easiest. Here is sample code that will do what you need:
GSK |
#******************************************* # MacDescription =Edit1.gsk # MacFileName =Edit1.gsk # MacAuthor = Kai Team # MacVersion=1.0 #******************************************* $LastVersion="1.0" MACSETTINGS Type=R FileCheck=N $ThisVersion=MacHeader("MacVersion") IF $ThisVersion>$LastVersion MSGOK Msg=This is a new version. ELSE MSGOK Msg=This is the same version ENDIF |
Run this code once, then edit the macro to increase the MacVersion number and run it again to see how it works.
Caveats:
1) You must have a properly formatted GSAK Macro Header in your macro.
2) You must use straightforward version numbering - i.e. use 1.0, 1.1, 1.2, not "2.3.7B 12-31-13 Mountain Lion".
