GSAK (Geocaching Swiss Army Knife)
Contents - Index

MacSettings (command)


MacSettings <Type=S|R> [<Vars=Variable names>] [<File=MacName.xml>] [FileCheck=Y|N]

The primary use for this command is to facilitate the save and restore of settings in a macro.

Type - S = Save, R=Restore

Vars - A comma delimited list of variable names (remove the $) to save/restore. If type is "S" then this parameter is required and must include at least one variable name. If type is "R" then this parameter can be omitted, in which case all variables saved in the file will be restored.

File - Optional parameter that is the file name to store these settings. If this parameter is omitted then a file with the same name as the macro but with an extension of .xml will be created/read in the same folder as the macro. If you enter just a file name (no path details), then that file name will be created/read in the same folder as the macro

FileCheck - This parameter would is optional, and when left off defaults to Y which will throw a macro error if the settings file does not exist when type=R. If set to N, then The macro will continue as if the file does not exist (effectively doing nothing). This setting is meaningless when Type=S

For example, you create a form that as an edit box and 2 check boxes, the corresponding variable names being $edtName, $chkOption1, $chkOption2 respectively.

In its simplest form to save your form variables the code would be
 

MacSettings Type=S Vars=edtName,chkOption1,chkOpton2

 
To restore the same settings (all variables) the code would be:
 

MacSettings Type=R

 
Having the option to enter the file name allows you to have "groups" of settings for the same macro.

Having the option to enter individual field names allows you to restore just those field names if required.

Alpha List         Category List
Copyright 2004-2019 CWE Computer Services  
Privacy Policy Contact