System Functions
RunConsoleProcess(program)
RunConsoleProcess lets you start another application («program») from Analytica, pass it parameters and/or a data file, and obtain results when the process completes.
Requires Analytica Enterprise or Power Player.
ReadTextFile(filename)
Returns the contents of a text file, named «filename», as a text value.
- ReadTextFile(filename: textual)
Requires Analytica Enterprise or Power Player.
WriteTextFile(filename)
Writes text to a file with name «filename».
- WriteTextFile(filename: textual; text: coerce textual; append, warn: optional numeric; sep: optional textual)
Requires Analytica Enterprise or Power Player.
ShowPdfFile
Launches Adobe Acrobat or Acrobat reader, if installed, and displays an Adobe Acrobat PDF file. The file might contain documentation or a user guide for your model, for example, and could be opened by a button script.
- ShowPdfFile(filename: atomic textual; bookmark: optional atomic textual; search,bookmarks: optional atomic boolean)
You can optionally specify a bookmark within the PDF file to open to. However, this will have no effect for users who only have a newer (post 2004) version the free Acrobat Reader installed. Around 2004, Adobe removed this capability from their free reader. Also, you can specify whether the bookmark panel or search panel should be visible when the document opens, which again does nothing on the newer free Acrobat readers.
GetRegistryValue(root)
Reads a value from the Windows system registry. This can be quite useful if you install your Analytica model as part of a larger application, and if your model needs to find certain data files on the user's computer (for example, for use with ReadTextFile or RunConsoleProcess). The locations of those files could be stored in the registry by your installer, so that your model knows where to look.
- GetRegistryValue(root: atomic textual; subfolder, name: optional atomic textual; warn: optional atomic boolean)
«Root» must be one of:
"HKCR"
or"HKEY_CLASSES_ROOT"
"HKLM"
or"HKEY_LOCAL_MACHINE"
"HKCU"
or"HKEY_CURRENT_USER"
"HKPD"
or"HKEY_PERFORMANCE_DATA"
"HKCC"
or"HKEY_CURRENT_CONFIG"
"HKDD"
or"HKEY_DYN_DATA"
«Subfolder» specifies the path from the root to the folder containing the key of interest. The levels of the path may be separated by /
or \
. If the root is "HKLM"
and the subfolder begins with "ANA"
or "ANAVER"
, the Analytica application folder is used, for example: "ANA" → "Software/Lumina Decision Systems/Analytica"
and "ANAVER" → "Software/Lumina Decision Systems/Analytica/3.2"
. (Note: In a private label version, the path mapped to by ANA
will be different.) If the root is "HKCU"
and the subfolder begins with "ANA"
, the Analytica folder for the current user is used ("Software/Lumina Decision Systems/Analytica"
(again, this path is different in a private label version). Examples of these would be:
GetRegistryValue("HKLM", "ANAVER", "home")
GetRegistryValue("HKCU", "ANA/MOT", "rootdir")
Name specifies the value name within the subfolder to retrieve.
The following registry data types are recognized and are returned as the indicated Analytica type
REG_SZ
andREG_EXPAND_SZ
: Returned as TextREG_DWORD
: Returned as NumericREG_MULTI_SZ
: Returned as a null-indexed list of text strings.REG_NONE
: Returned as Null (without warning)- Any other: An embedded warning is issued and Null returned.
If the subfolder or value is not found, a warning is issued and Null returned. The various warnings that might occur can be suppressed either by setting the optional «warn» parameter to False
, or by wrapping the function call in an IgnoreWarnings function.
This function cannot be used to alter or enumerate registry data. Analytica does not provide a function to change registry data.
History
Introduced in Analytica 4.0.
Enable comment auto-refresher