File System Typescript Commands



These Typescript commands deal with reading or writing files, saving or loading models, etc.

Include

Reads in a module or library from a file on disk.

include forceAscii, class ident, formatId, platformID, sysLib, xml, filename

Example:

include 0, LinkLibrary Distribution_variati,2,2,0,0,C:\Program Files\Lumina\Analytica 4.2\Libraries\Distribution Variations.ANA

«ForceAscii» is usually 0, but in rare occasions may be 1 when the included file is forces to save in an ASCII format (as opposed to the usual UTF-8 format).

The «formatId» number specifies whether system variables declared in the included file should be ignored, or whether they should override existing system variables. Saved module files and libraries don't save system variables, so this is only relevant when the included file is a model. If this is set to 3, then system variable changes in the include file are ignored, when set to 2 then any system variable changes will change the system variables in memory. Then needs to be 2 or more. Very early releases of Analytica set this to 0 or 1 and the «filename» was the 6th (not 7th) parameter.

The «platformID» records the operating system that the file was last saved in. This is always 2 for Windows. Other reserved values (not currently in use) are 1=Mac, 3=Unix.

The «sysLib» specifies whether this is a system library, from the Analytica Libraries folder. When this is set to 1, then it knows to look in the Libraries folder even if your model file has been saved to a very different location (which would alter the relative path to the originally included file). The installed library folders are listed in the system registry AddLibraryDir value in the "HKLM / Software Decision Systems / Analytica / «release»" folder. Multiple directories can be listed there, separated by the pipe ('|') character.

The «xml» flag is 0 when the include file is in the Demos file format (i.e., the standard Analytica model file format) and 1 when it is an XML file.

«filename» is the relative path (relative to the model file's location, or more precisely, relative to the CurrentModelFolder) to the included file.

The include command is designed for use inside a model, to be executed while the model is loading. In general, it is difficult to get it to work from a button script or directly from the typescript console. For those uses, the AddModuleOrLibrary function is recommended.

Update

Puts Analytica into an update (merge) mode, so that it allows redeclarations of already created objects. Existing attributes of such objects will be overwritten by new attributes. This mode is used when merging a new version of a module or library into an existing model.

EndUpdate

Ends the Update mode begun with the Update command.

Save

This command saves the model or selected linked modules to disk. It does not work well prior to 4.4.3, and is not supported. More detailed documentation is at Save.

SoftwareVersion

When a model file is being loaded, this command specifies the release number of the Analytica software that the file was saved from. If the version specified is later than the current release number, the command triggers the display of a warning stating that the model is from a more recent version of Analytica.

If the specified release number is earlier than the current release, configures the Analytica reader and parser to accept the format and syntax that was in use at the time the model was saved, and may also trigger certain conversions to be made as the file is loaded to ensure backward compatibility (so that models from older releases continue to run in newer releases). The configuration remains active until the file being read is closed.

This command is usually the first command appearing inside a model or module file saved by Analytica.

Obfuscated

The presence of this command in an input channel marks the input channel being in an obfuscated format. The characters read from that point on are assumed to be encrypted.

You do not want to type this into the typescript window (otherwise, you'd have to type everything in encrypted form, which presumably you would not know how to do).

Model or module files saved from Analytica Enterprise using "Save A Copy..." with the obfuscate checkbox will write this command, then write the remainder of the file in an obfuscated (encrypted) format.

SkipOverNextLines

Ignores the next typescript line. With a number, e.g.:

SkipOverNextLines 3

ignore the next 3 typescript lines. When used with version-gated comments, this provides a way to conditional typescript, where the typescript executed is different when executed from different releases of Analytica. For example:

{!40200|SkipOverNextLines}
Error("Earlier than Analytica 4.2")
{!40200|MsgBox("Analytica 4.2 or later")}


----
----

The following commands have something to do with File output, but they may belong in the deprecated category.

Record

PauseRecord

EndRecord

ResumeRecord

There seems to have been some sort of facility in earlier versions of Analytica ("Demos") to open a "record channel", most probably an output file. These commands open a file as the current output channel, suspend and resume this as the current output channel, and close the channel.

This is a feature from very early days of Demos and is rarely used.

Photo

PausePhoto

ResumePhoto

EndPhoto

The photo file/buffer is logs output that is printed to the typescript window to a file.

There is a "Photo" feature in ADE, which is documented, and indeed does exactly this -- keeps a log of all typescript interaction since ADE started.

To start capturing output, type

Photo "filename.txt"

an open file dialog pops up, allowing you to specify the output file for the log. When you are done, type

EndPhoto

you can then view the log from a text editor.

This feature is useful for debugging a problem as it enables to see a trace of the order in which variables are being evaluated. If the trace is very long, it does not fit in the typescript window, so the Photo feature can be used to create a log of variable evaluations as follows:

 > Verbosity : 4    { To print the evaluation trace }
 > Photo "log.txt"           { To start the log -- then I specified a filename: log.txt }
 { In the GUI, load the model and show result for the output variable }
 > EndPhoto
 { Then I loaded log.txt into a text editor }

See Also

Comments


You are not allowed to post comments.