Is it possible to save changes made to a variable from run to run? For example have a certain set of code only run the first time you execute the script?
AppleScript technically has something that will do it: OSAStore and OSALoad, but I would recommend relying on this and read/write this in a more conventional way from a file.