Satimage Previous | Next
The permanent variables
Home Documentation Smile AppleScript terminals Using AppleScript in Smile The permanent variables  
You can define variables that Smile will save when you quit, and which will be available next time you launch Smile: permanent variables. Typically, you may want to use permanent variables to store a user's preferences.
In addition to be persistent, permanent variables are global.

To define a permanent variable, use the my prefix:
set my user_preferred_format to some_value
To read the value of a permanent variable, use the my prefix and the get verb:
set the_variable to (get my user_preferred_format)
Permanent variables are available from all scripts running in Smile. A script using a permanent variable should typically include the following block:
try
    get my user_preferred_format
on error -- not defined yet
    set my user_preferred_format to some_default_format
end
In a handler, you can use the permanent variables as well: you do not have to declare them as global variables.
Manipulating the permanent variables
In you intend to do an advanced usage of the permanent variables, visit the page below. The page describes where the permanent variables are stored, how to reset them, how to define a default set of permanent variables, and how to view them all.
Version française
Copyright ©2008 Paris, Satimage