Requires Analytica 4.4.3 or later. (The command is present in all releases before that, but not robust, not documented, not supported, and not with the syntax described here).
Save [Copy] [Replace] [Standard|XML|Encrypted|BrowseOnly] [All|Only] [Model|«moduleIdent»] [in «filename»]
Save is a typescript command that saves a model or linked modules to a file. All parameters are optional. In desktop Analytica, a file save dialog will appear whenever there is an issue with the destination, or there is potential to clobber an existing file.
- Save [Copy] [Replace] [Standard|XML|Encrypted|BrowseOnly] [All|Only] [Model|«moduleIdent»] [in «filename»]
- Save a copy.
- If the destination exists and is writable, replace it without asking.
- Save in the standard "Demos" file format (Analytica's usual model file format).
- Save in XML format.
- Save in a locked and encrypted (aka obfuscated) format. Implies "copy". When using this, be very careful to save to a destination other than your original model file, because encryption is irreversible. You should always save an encrypted copy to a different file name, which you can distribute to others, but keep the unencrypted master somewhere safe for your own use. Encrypted modules lock hidden definitions so that they cannot be unhidden. This option is only available in Analytica Enterprise.
- Save as browse-only. Users will not be able to make changes to the model, even if they have a non-Player edition of Analytica. BrowseOnly models are also encrypted, so see the comments that apply in the previous option to encrypted models and the importance of not saving over your master copy.
- Embed the contents of all linked modules into a single file.
- Save only the module indicated by «moduleIdent» (or only the top-level module if that is not specified), without saving linked submodules that are dirty (a module is dirty if changes have been made that need to be saved). If this is not specified, any submodules that have changes pending will be saved to their original filename.
- Save the top-level model (the default).
- The identifier of the linked module that should be saved.
- The destination filename, relative to the CurrentModelFolder(). If the filename has spaces, you should put quotes around it.
Same as the File → Save menu option. Saves the model, and any linked modules with pending changes:
Save the model into a new filename:
Save in MyModel.ana
Save a copy of the model, replacing an existing one if it already exists:
Save Copy in "MyModel Copy.ana"
Save the model in an XML format:
Save the model in the standard Analytica ("Demos") format, even if it had been previous saved as XML:
Save an encrypted copy of the model, dialog if file already exists (because
Replace isn't specified).
Save encrypted copy in "MyModel Copy.ana"
Save changes in linked library:
Save changes to the linked library in a new file:
Save Finance_library in "C:\public\finance library.ana"
Save only the top-level model without saving any changes inside linked modules:
Save everthing into a single file by embedding linked modules:
Save All in "MyModel Everything.ana"
You can only control the filename and format of the top-level model or module being saved (i.e., the module specified by «moduleIdent»). All sub-modules are saved in their original formats to their original locations.
If you do not use the
Copy flag, the destination of the model or module is moved. This is particularly relevant for linked modules, since this means when the model is loaded next time, it will load the version you just saved. On the other hand, if you use the
Copy flag, then a copy is saved, but your model will continue to load the module from its original location.
The syntax and semantics of the command has been updated as of build 4.4.3. The command has been around since the beginning of Demos (early version of Analytica from circa 1980), but the older syntax and functionality is not documented in any of the Analytica documentation, and has never been supported. In build 4.4.3, it was revisited to bring it more up-to-date and make it more robust. A few esoteric functionalities were eliminated (presumably few or no people know about these or remember them).
The Save command can be used from a button script, and from the EvaluateScript function.
When Save is used without the
Copy flag (and without an option that implies
Copy), the Att_Dirty flag is cleared for any successfully saved modules.
When Save is actually writing the file, it writes to a temporary file with a name such as "
Temp of MyModel.ana". If the save is entirely successful, then it renames this to your file name, replacing the one that was there. If anything goes wrong, then the temporary is removed and the original file remains in tact.
The save dialog will appear, even if
Replace is specified, if a problem exists, such as a read-only directory, invalid file name, etc.
Enable comment auto-refresher