Satimage Previous
Manipulating the permanent variables
Home Documentation Smile AppleScript terminals Using AppleScript in Smile The permanent variables Manipulating the permanent variables  
  • When Smile quits, it saves the permanent variables into a compiled script whose path is:
        /Users/<login▸/Library/Application /Smile/Class Scripts/Globals
    If you remove that file while Smile is running, Smile will save the permanent variables in a new file when it quits.

  • As long as you do not quit, the permanent variables are not saved: they just live in Smile's AppleScript context. If Smile crashes, they do not get saved and next time you launch Smile you get the permanent variables (including your preferences) as they were when latest saved - the last time you quit Smile normally.
    To force Smile to save the permanent variables now, just run the following command.
  • To delete the permanent variables, quit Smile, then move the Globals file out of:
    /Users/<login>/Library/Application Support/Smile/Class Scripts/
    This will kill all the permanent variables, and it will also reset to their default values the preferences that Smile defines (such as the settings visible in the Preferences dialog or the latest searched string).
  • When Smile is launched without a Globals file in the location above, it loads as permanent variables the properties (and handlers) which are stored (in the application's bundle) in Scripts/SmileGlobals. Those are variables which are required for the normal behavior of Smile. Furthermore, if a Globals file exists in the same location, Smile also loads as permanent variables the properties (and handlers) which are stored in that file.

    Thus if you distribute a customized solution based on Smile, you may want to edit SmileGlobals, and you may want to store default values for the permanent variables specific to your solution in the Globals file.
  • Though the permanent variables are stored in Globals, they are not stored in its source: if you open the Globals file you will not view your current permanent variables.
    To view the permanent variables currently defined, use the following lines.
    name of every variable of globals
      --  {"nruns", "wantupper", "gwrap", etc.}
    returns the list of the names of the permanent variables, and:
    every variable of globals
      --  {nRuns:404, wantUpper:true, gWrap:true, etc.}
    returns the list of the names and values in a record.
Version française
Copyright ©2008 Paris, Satimage