AS Language guide:
property x: 3 This statement declares a property and sets its initial value. The scope of a property declaration can be either a script object or an entire script. The value set by a property declaration is not reset each time the script is run; instead, it persists until the script is recompiled.
property ss : 1
on will finish launching theObject
log ss
set ss to ss + 1
end will finish launching
In Script Editor (i.e. plain AppleScript) the property saves the value. Save the below in Script Editor as an application and run it over and over:
property ss : 1
set ss to ss + 1
display dialog ss
In XCode, the property does not work the same way. You must find another way to keep a value saved. I usually use the PList file for the app as there is built-in methods of reading and writing to the PList file. You could also make up your own method, saving out a text file or whatever.
The basic form to do this using your example is:
property ss : 1
on will finish launching theObject
--Read in the prefs or create it using the default value if this is the first time running the app
if not (exists default entry "ss" of user defaults) then
make new default entry at end of default entries of user defaults with properties {name:"ss", contents:ss}
else --The pref exists so just read in the current value
set ss to contents of default entry "ss" of user defaults
end if
log ss
set ss to ss + 1
--Write the new value to the PList file.
set contents of default entry "ss" of user defaults to ss
end will finish launching
Model: iMac Intel 10.5.5
Browser: Firefox 3.0.2
Operating System: Mac OS X (10.5)