Quantcast
Channel: GSAK Forum
Viewing all articles
Browse latest Browse all 75812

How to run a line in a macro only the first time by Kai Team - 2013-12-04

$
0
0
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:

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". wink.gif

Viewing all articles
Browse latest Browse all 75812

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>