VS:GetSavedSetting: Difference between revisions
No edit summary |
m (1 revision) |
(No difference)
|
Latest revision as of 14:32, 12 August 2013
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Reads a value from the saved settnigs file. This can be used to remember various user settings between running sessions of VectorWorks. For example, a script may want to remember a dialog's position or a font settings. The saved settings should not be used for critical information, but rather for convenience settings.
If the settings file is lost or damaged the script should revert to a reasonable default value, and typically this would not warrant an alert dialog.
FUNCTION GetSavedSetting(
category :STRING;
setting :STRING;
VAR value :STRING) : BOOLEAN;
def vs.GetSavedSetting(category, setting): return (BOOLEAN, value)
Parameters
category STRING setting STRING value STRING
Return Value
Returns true is the requested setting is found and read from the saved settings file, false otherwise.
Remarks
This routine operates on XML memory.
It also access the file SavedSettingsUser.xml in the User's > setting folder, should that be available. See SetSavedSetting for more info.
The script below illustrates how it works. Open the "Settings" folder in your user's folder, move out the file SavedSettingsUser.xml, should you have it there already. Then launch the script below some times, save file and quit application. If you didn't have the file SavedSettingsUser.xml there, one such file will be created after quitting VW. But you'll notice that the values returned in the dialog are always increasing every time the script runs. From memory. The file wasn't there while you runned it.
PROCEDURE Example; VAR incremented : INTEGER; temp_s : STRING; temp_b : BOOLEAN; BEGIN temp_b := GetSavedSetting('Bombarder', 'BOMB', temp_s); IF NOT ValidNumStr(temp_s, incremented) THEN BEGIN incremented := 1; END ELSE BEGIN incremented := incremented + 1; END; SetSavedSetting('Bombarder', 'BOMB', Concat(incremented)); AlrtDialog(Concat(incremented)); END; RUN(Example);
Version
Availability: from VectorWorks12.0
See Also
VS:SetSavedSetting