GoFiler Legato Script Reference
Legato v 1.5b Application v 5.24b
|
Table of Contents | < < Previous | Next >> |
Chapter Sixteen — Application (continued)
Scripts can store and read settings within INI style files and the Windows Registry. INI style settings can be stored as text or as encrypted text while registry settings are constrained by the data types supported by Windows.
As a matter of convention, scripts should store the majority of their settings within INI files, and, to the extent possible, in the users application area. This makes the settings unique to the user and also does not pollute or bloat the Windows Registry. Generally, the INI format is useful for private and local information while the registry tends to be used for more widely available data.
Application data is split into two files stored in the user data area: Settings and Preferences. Settings are incidental data such as file history, application screen position etc, while preferences are parameters ranging from EDGAR data, default project information, conversion options, etc. While they are both stored in INI file format, the application preferences are managed in a manner in which it is not safe to access the file directly.
An important note as to terminology and legacy support: as the application evolved and grew, the need to maintain legacy support was paramount. Hence, the preferences are stored in the file with the suffix ‘settings’. For example, for GoFiler Complete, the application ‘preferences’ are stored in the file “GoFiler Complete Settings.ini” while the ‘settings’ are stored in the name “GoFiler Complete.ini”. The second name for settings is typical for Windows application.
16.4.2 Application Preferences
Obviously, an area of concern is accessing the actual application preferences (in other words, those settings that adjust the performance of the actual host application).
Application preferences (“Preferences”) are stored in INI format and, as in many applications, they can be adjusted from a ribbon menu function (FILE_SETTINGS_QUERY). The tabs presented are structured by each module within the application. Not all applications contain all modules and therefore do not contain all tabs.
If the settings within the INI file are manually edited and reapplied, they will be applied to the specific sections of the program. Depending on the context, some settings may not immediately take effect. For example, in the above image, the file share mode would not apply to files currently open within the application.
General settings, such as desktop position, are located in the application’s INI file. The GetApplicationSettingsName function can be used to get the name of the file to access the data directly.
The INI format is a loose standard to store settings. Originally, the term ‘INI’ was short for “initialization file,” as used by Windows to store all of its settings. For the most, part INI files have been phased out in favor of the newer Windows Registry as introduced with Windows NT. However, the simple format certainly has its uses and further, can be used to avoid registry bloat and keep other applications from easily accessing application data.
The format is simple text in the form of:
[section]
entry=value
entry=value
entry=value
Where the section is a group of data which in turn contains one or more entry=value pairs. The entry names must be unique and the values must be strings. If numeric or binary data is to be stored, it must be first converted into a valid text string and then restored on read.
The application also uses a number of INI files which can be accessed. Further, a layer of encrypted functions are also provided to store sensitive information. Accessing an INI file is limited by the security rights of the program. Those rights extend to the specified file and its location.
Finally, INI files can be manually opened and edited in Notepad or in the application. Be mindful that opening the file in the application and then attempting to access or write the file will result in an access error since the application will lock the file.
The Windows registry is a system-defined, system-wide database, in which applications and system components store and retrieve configuration data. The data stored in the registry varies according to the version of Microsoft Windows. Generally speaking, only application installation, specific settings and system information should be stored in the registry.
Scripts can use registry functions to retrieve, modify, or delete registry data. Scripts should avoid editing or deleted registry data that does not belong to the application or script unless it is absolutely necessary. Altering certain keys and their data may result in undesirable operation of the system and other components.
Entries within the registry are stored as named values within a key. Keys define a tree-like structure with a number of standard top branches, such as the ‘user’ or HKEY_CURRENT_USER that, in turn, contain a series of subkeys. In addition to named values, each key will also have a default or unnamed value.
Values can have a number of data types, these are as follows:
Definition (WinSDK) | Value | Description | |||
REG_NONE | 0 | No value type (error) | |||
REG_SZ | 1 | Unicode /0 Terminated String | |||
REG_EXPAND_SZ | 2 | Unicode /0 Environment Variables | |||
REG_BINARY | 3 | Free Form Binary Data | |||
REG_DWORD | 4 | 32-bit Number (not sign specific) | |||
REG_DWORD_LITTLE_ENDIAN | 4 | Same as REG_DWORD (defined by WinSDK) | |||
REG_DWORD_BIG_ENDIAN | 5 | 32-bit Number Swapped Order | |||
REG_LINK | 6 | Symbolic Link (unicode) | |||
REG_MULTI_SZ | 7 | Multiple Unicode Strings | |||
REG_RESOURCE_LIST | 8 | Resource List in the Resource Map | |||
REG_FULL_RESOURCE_DESCRIPTOR | 9 | Resource List in the Hardware Desc | |||
REG_RESOURCE_REQUIREMENTS_LIST | 10 | Resource Requirements List | |||
REG_QWORD | 11 | 64-bit Number (not sign specific) | |||
REG_QWORD_LITTLE_ENDIAN | 11 | 64-bit Number (same as REG_QWORD) |
Legato automatically maps various variable types to registry type, however, not all types are supported.
Certain key locations require administrative rights to update or create new keys and certain root keys are also an amalgam created for the user profile. Understanding the organization of registry data is too advanced and lengthy to discuss within this manual. Suffice it to say, accessing the registry is an advance aspect of Legato and provided to allow access to a critical part of the underlying operating system.
GetSetting — Reads a string from the application, script for specified settings (INI) file.
PutSetting — Writes a string from the application, script for specified settings (INI) file.
GetEncryptedSetting — Reads an encrypted string from the application, script for specified settings (INI) file.
PutEncryptedSetting — Writes an encrypted string from the application, script for specified settings (INI) file.
RegistryCreateKey — Creates a key name at the specified location.
RegistryDeleteKey — Deletes a specified key. This key cannot contain other keys.
RegistryDeleteValue — Deletes a specified value entry from a key.
RegistryEnumerateKeys — Enumerates all the key nodes for specified key name.
RegistryEnumerateNames — Enumerates all the value names for specified key node.
RegistryGet32Word — Returns the value of a specified key as a 32-bit numeric value.
RegistryGet64Word — Returns the value of a specified key as a 64-bit numeric value.
RegistryGetBlock — Returns a binary block of information into the specified data parameter.
RegistryGetFloat — Accesses a key value as a 64-bit REG_QWORD and converts it to a float.
RegistryGetString — Returns the value of a specified key as a string.
RegistryGetType — Returns the type of data for the associated value name.
RegistrySetValue — Sets the value of a specified key to the variable or value provided.
GetApplicationSettingsName — Gets the application settings (INI) filename and path.
GetPreferenceData — Returns the application preferences as a string.
GetPreferenceFile — Returns the filename and path for the preference files being used.
LoadPreferences — Loads the preferences from a specified file.
ResetPreferences — Resets the application preference to the installation defaults.
SavePreferences — Saves the application preferences to the default location or a specified file.
SetPreferences — Sets specific preferences from a string.
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.