GSAK (Geocaching Swiss Army Knife)
MACROSET <Dialog=Dialog name> <VarName=Variable name> [<name=setting name>]
Dialog - This is the name of the dialog to which these settings will be updated. Valid dialog names are:
GcGeocaches ("Geocaching.com access=>Get geocaches")
PqLoad ("Geocaching.com access=>Download pocket queries")
VarName = This is the name of the variable that contains all the settings for this command. This variable will usually be created using the <data> command.
Name = Optional parameter and the default is <macro>. This is the setting name that will be updated/added by using the MacroSet command. As this command would usually be used to embed settings so the macro will run on any computer, you would usually use the default name of <macro>. This default name allows you to use the <macro> setting as a type of temporary work name that can be updated time and time again without affecting any other settings on the target computer. However, there may be times you do actually want to update or add a particular setting name to the relevant drop down box in the GSAK GUI (for a complete example, see this link). In this case add this parameter with the required name, but be aware if this setting does exist on the target computer it will be completely overridden without warning.
Note: The dialog "Filter" does not have settings per se, but a saved filter name. For this dialog, to help better understand Name=, substitue "filter name" when interepting "settings name"
MacroSet is a powerful command that enables you to embed settings and filters inside the macro language. This will let you to distribute macros to other users and not have to provide instructions on what settings are required. The end user can then run the macro without having to first create any required settings or filters.
You can embed settings for any filter or macro command that uses the SETTINGS parameter. The VarName must be a variable that contains the contents of these settings and is usually the result of a <data> command. I really don't expect anyone to learn or follow the syntax of all the possible elements than can be in the <data> stream, but I have made generation of this data stream quite easy (I hope!)
To generate the data stream for any settings you want to embed:
1. Open the dialog you want to embed settings for
2. Set up all the items how you would like them for use in the macro
3. Click on the "save" button
4. Enter the name <macro> (very important you get this right, but it is not case sensitive)
5. Because you enter the special name of <macro>, the required code is copied to the clipboard
6. Paste the code into your required macro.
A variable name will be allocated for you, but you can change this to anything you like. Now when ever you want to use those settings for that command in a macro, you just need to use the MacroSet command with that variable, and on the command that supports settings use the name as per the name= parameter (default is <macro>)
For example: We want to distribute a macro that will first filter on all unfound caches (excluding placed by you) then copy these over to a new database called "Unfound by me". Without knowing anything about the settings or filters on the target computer you can write a macro that will do all of this for any computer that has GSAK. First, create a new macro file (either via the GSAK macro editor or your own preferred text editor). The new file will have no lines of code in it.
Open up the filter dialog, and uncheck the found box in the "found status". Also make sure you have the "Exclude caches placed by you box" ticked. Now click on the save button and enter the name <macro>. Now paste this code into your macro.
Now cancel out of the filter and go to Database=>Move/Copy Waypoints... Now change this dialog so you have the "copy" radio button selected, the "replace" radio button selected, and the "Add" radio button selected. Now click on the "Save" button and enter the name <macro>. Now paste this code to the end of your macro. Your macro code should now look something like this:
Change what ever is after the cbxDestination= to Unfound by me (You couldn't do this at the time of using the move/copy dialog unless that database actually existed in your copy of GSAK)
Now to complete the macro just add the following lines to the start of the macro
This Macro should now run on any target computer regardless of settings and filters
Alpha List Category List
Copyright 2004-2011 CWE Computer Services |