Jump to content

Cache Raid Macro


KC8JZK

Recommended Posts

I am also having trouble with the macro. I have never tried a macro before and don't have a clue as to how to write one or understand how or why it works. As a result the errors I get don't mean much to me.

 

I am using GSAK 6.0.0 (Build=45) - I unzipped the macro file into the GSAK folder called Macros. I then followed the directions to do a Macro Button Configuration and chose Macro 1 M1 and named it CacheRaid with the file being the CacheRaid.txt file in the GSAK Macros folder.

 

I then dragged the M1 button to my tool bar. I selected my database that I call "Main Database" which has 2170 caches in it. I highlighted one of the caches in this database (is that the way to select the cache that this macro builds from?). I left the default to 10 caches and clicked OK. I end up with a macro error:

 

Current Macro: C:\Program Files\GSAK\Macros\CacheRaid.txt

 

Error in Macro at Line: 80

FILTER name="Cache Raid"

 

Error=> Filter not found: Cache Raid

 

Macro will now abort

 

So I figured I needed to set up a filter called Cache Raid. But when I did this I just ended up with a filter named Cache Raid but it had the same number of caches as my Main Database. I went back to my Main Database and I chose (hi-lighted) a cache again and clicked the M1 button on my tool bar. This time I ended up with this macro error:

 

Error in Macro at Line: 83

MOVE COPY settings="chain1"

 

Error=> Settings not found: chain1

 

Macro will now abort

 

I must be doing something wrong, but I can't seem to figure out what to try next.

 

Suggestions would be greatly appreciated. Thanks!

Edited by TeddyTexas
Link to comment

My apologies on that.

 

The zip file you downloaed from http://gsak.net/Macros.php did not have the updated 6.0 version of the CacheRait.txt macro

 

The individual file is ok, just the zip file is the problem. I have now fixed this, so please download and uznip again.

 

If you have a look at the macro (use a any text editor/viewer) you will see the prerequisites for running it.

 

The only prerequisite for this macro is that you have a saved filter called "Cache Raid"

 

Just set up this filter for the selection criteria for the Cache Raid (all un found caches is a popular one)

 

Now try again, and we will keep our fingers crossed that it works :lol:

Link to comment

Yeah this Macro is a touchy one... You have to set up several things BEFORE you try to run it. I will try to walk you thru it

 

First Step is to create 2 new Databased in GSAK

 

This is done by simply clicking on the DATABASE menu and selecting New (or hitting CTRL+N)... A pop up comes up asking for a new database name. Create one named Chain1 and one named Chain2.

 

Next Step is to create 2 saved Filters

 

Create a filter by clicking on the SEARCH menu and selection Filter (or hitting CTRL+F) ... A Very busy pop up will come up.

 

For the first filter. when the pop-up comes up Look about 3/4 the way down the first tab you will see a label User flag off to the side 2 boxes are checked Set and Not Set. Uncheck the Not Set box, then click the SAVE button on the bottom in the box the comes up enter the following

"user flag = set" (you enter everything in between the " " including the spaces and the =) then Click Ok

 

The next filter is the main one. This one determines what is selected for you "Raid" so it can be pretty much anything you want it to be .. one idea is just uncheck the Found box. What ever you decided at the end click Save and name it "Cache Raid" (again the space is requiried).

 

Now we are almost done.....

 

We need to create 2 Move/Copy settings.

 

You create a Move/Copy setting by Clicking the DATABASE menu and selecting Copy/Move Waypoints (sorry no shortcut this time)

 

For the first one change the Destination database to Chain1

make sure the Copy circle is selected

you also want the Replace and Add circles selected.

At the very bottom is a check box labeled "Display destination database" make sure that box is unchecked

Then click Save button and name it Chain1

 

Then Last but not least

for the second Move/Copy

change the Destination database to Chain2

this time make sure the Move circle is selected

you still want the Replace and Add circles selected.

and make sure the check box labeled "Display destination database" is unchecked

Then click Save button and name it Chain2

 

Now Finally you are ready to run the Macro. Place yourself in the Database that has the waypoints you want to create the Raid from. Highlight the first Waypoint you want in the chain. Then Select the Macro Menu and select Run... (or click CTRL+M).... Hit the little folder to open the CacheRaid.txt file and hit OK

 

It will ask you to enter the number of Waypoint to be in this raid. (one note this number MUST be less than or equal the number of waypoints in the starting Database) then hit OK

 

Depending on the number you pick it will run for a while, but it will end with you on the Chain2 Database looking at your raid list

 

Hope this helps

Link to comment
Yeah this Macro is a touchy one... You have to set up several things BEFORE you try to run it. I will try to walk you thru it

 

First Step is to create 2 new Databased in GSAK

 

This is done by simply clicking on the DATABASE menu and selecting New (or hitting CTRL+N)... A pop up comes up asking for a new database name. Create one named Chain1 and one named Chain2.

 

Next Step is to create 2 saved Filters

 

Create a filter by clicking on the SEARCH menu and selection Filter (or hitting CTRL+F) ... A Very busy pop up will come up.

 

For the first filter. when the pop-up comes up Look about 3/4 the way down the first tab you will see a label User flag off to the side 2 boxes are checked Set and Not Set. Uncheck the Not Set box, then click the SAVE button on the bottom in the box the comes up enter the following

"user flag = set" (you enter everything in between the " " including the spaces and the =) then Click Ok

 

The next filter is the main one. This one determines what is selected for you "Raid" so it can be pretty much anything you want it to be .. one idea is just uncheck the Found box. What ever you decided at the end click Save and name it "Cache Raid" (again the space is requiried).

 

Now we are almost done.....

 

We need to create 2 Move/Copy settings.

 

You create a Move/Copy setting by Clicking the DATABASE menu and selecting Copy/Move Waypoints (sorry no shortcut this time)

 

For the first one change the Destination database to Chain1

make sure the Copy circle is selected

you also want the Replace and Add circles selected.

At the very bottom is a check box labeled "Display destination database" make sure that box is unchecked

Then click Save button and name it Chain1

 

Then Last but not least

for the second Move/Copy

change the Destination database to Chain2

this time make sure the Move circle is selected

you still want the Replace and Add circles selected.

and make sure the check box labeled "Display destination database" is unchecked

Then click Save button and name it Chain2

 

Now Finally you are ready to run the Macro. Place yourself in the Database that has the waypoints you want to create the Raid from. Highlight the first Waypoint you want in the chain. Then Select the Macro Menu and select Run... (or click CTRL+M).... Hit the little folder to open the CacheRaid.txt file and hit OK

 

It will ask you to enter the number of Waypoint to be in this raid. (one note this number MUST be less than or equal the number of waypoints in the starting Database) then hit OK

 

Depending on the number you pick it will run for a while, but it will end with you on the Chain2 Database looking at your raid list

 

Hope this helps

Thanks Gener_Lee

 

However, this is only required in the macro supplied prior to version 6

 

One of the new features in version 6 is the ability to "embed" settings inside the macro. So now the chain1 and chain2 move settings need not be set up.

 

The only requirement for this macro now in V6 is to set up a saved filter called "Cache Raid".

 

I could have embedded that also, but the problem is I see this filter being different for each users requirements

Link to comment

I did the following:

 

I downloaded and unzipped the file from http://gsak.net/Macros.php but it seemed to just overwrite all of the macros with the same date as I had in my GSAK/Macros folder.

 

I then went into my Main Database and created a Cache Raid filter and set up this filter for the selection criteria for the Cache Raid. I unchecked the Found box in the Found Status section, and also unchecked the Archived and Temporarily Unavailable boxes in the Available Status section. By doing this I believe that I am telling the filter that I want only caches that I have not found or placed by me, and only available caches.

 

I then went back to my Main Database and hilighted one cache to select the cache for the micro to build from. Is that the correct thing to do?

 

But, when I ran the macro I still got the same error as I did before:

 

Error in Macro at Line: 83

MOVECOPY settings="chain1"

 

Error=> Settings not found: chain1

 

Macro will now abort

 

I noticed that I now have two new data bases with nothing in them - chain1 and chain2 (I had seen them before and they were empty, so each time I tried to run the macro I had deleted them).

 

Any ideas of what to do now? Thanks!

Link to comment
I did the following:

 

I downloaded and unzipped the file from http://gsak.net/Macros.php but it seemed to just overwrite all of the macros with the same date as I had in my GSAK/Macros folder.

 

I then went into my Main Database and created a Cache Raid filter and set up this filter for the selection criteria for the Cache Raid. I unchecked the Found box in the Found Status section, and also unchecked the Archived and Temporarily Unavailable boxes in the Available Status section. By doing this I believe that I am telling the filter that I want only caches that I have not found or placed by me, and only available caches.

 

I then went back to my Main Database and hilighted one cache to select the cache for the micro to build from. Is that the correct thing to do?

 

But, when I ran the macro I still got the same error as I did before:

 

Error in Macro at Line: 83

MOVECOPY settings="chain1"

 

Error=> Settings not found: chain1

 

Macro will now abort

 

I noticed that I now have two new data bases with nothing in them - chain1 and chain2 (I had seen them before and they were empty, so each time I tried to run the macro I had deleted them).

 

Any ideas of what to do now? Thanks!

Yes, your understanding is correct.

 

I just had a look at the web site and it does have the correct version of the Macro.zip file, so perhaps your ISP or browser is caching the old version

 

The latest version of the file should be dated 10th August 2005

 

Try deleting the file and download again.

 

You can also download just the CacheRaid.txt macro from that page without downloading the whole zip file

 

To make sure you have the right version of the CacheRaid.txt macro, open it up with notepad (or any text editor/viewer) and have a look at the prerequisites. If it mentions chain1 asnd chain2, then you have the old incorrect version. There should only be the reference to the need to create the "Cache Raid" macro.

 

I will paste it here so you can compare

 

###################################################################

# Cache Raid Macro

#

# The following macro will generate a route of caches that are the closest

# distance from each other for a "cache raid". Basically, the macro allows

# you to build a "cache chain". You select a cache then the macro will build

# a database of a direct route of the caches that are the shortest distance

# from last one (of course ignoring caches that are already in your "cache chain").

# You can then use this "route" to plan your next cache raid. Note: this is

# not quite as sophisticated as selecting a centre point then doing the

# calculations to provide the shortest route to collect all caches within x

# miles of this point.

#

# This version just keeps on selecting the cache that is the next closest

# then adds it to the "cache raid" database. So depending what your starting

# cache is, and how many you want for this "cache raid" you could end up anywhere

# (of course you could always start by setting a filter that is x miles from your

# starting point to make sure you don't end up too far from your starting point)

#

# Depending on your settings some of the following commands may not

# be required, however by putting these in this makes sure this macro

# will work no matter what your current sort sequence is or what settings

# you have.

#

# Macro Requirements:

#

#

# 1. Saved Filter called "Cache Raid":

#    set up your required filter, for example status = not found

#   

#########################################################################

 

# Un comment the next line if you want to run the macro one line at a time

#DEBUG Status="on"

#speedmode status=off

 

# Prompt the user for how many caches in the cache chain

INPUT Msg="Please enter number of caches for this raid" Default=10 VarName=$NumberOfCaches

 

# VarName of the input command always type casts the variable to string, must now convert to numeric

SET $NumberOfCaches = Val($NumberOfCaches)

 

# Save the name of the current database we are working in

SET $CurrentData = $_CurrentDatabase

 

# first clear all user flags

MACROFLAG Type=clear Range=all

 

# set user flag for starting cache

MACROFLAG Type=set Range=1

 

# make sure the chain1 and chain2 databases are empty

IF DatabaseExists("chain1")

  DATABASE Name="chain1" Action=delete

ENDIF

IF DatabaseExists("chain2") 

  DATABASE Name="chain2" Action=delete

ENDIF 

DATABASE Name="chain1" Action=create

DATABASE Name="chain2" Action=create

 

# select the starting database again

DATABASE Name="$CurrentData"

 

# now select only the required waypoints for the cache raid

FILTER Name="Cache Raid"

 

# copy over all waypoints to chain1 database

MacroSet Dialog=MoveCopy VarName=$Chain1

MOVECOPY Settings=<macro>

DATABASE Name="chain1"

 

#set center to the starting waypoint

MFILTER If=$d_MacroFlag

IF $_FilterCount = 0

  SET $Message = "The cache you first selected is not in your 'Cache Raid' filter" + $_NewLine + $_NewLine + "Macro will now abort"

  PAUSE Msg="$Message"

  DATABASE Name="$CurrentData"

  CANCEL

ENDIF

# First make sure distances are calculated from your starting cache

CENTER

 

SORT By="distance"

MacroSet Dialog=MoveCopy VarName=$Chain2

# now start moving waypoints to the chain2 database

SET $j = 0

WHILE $j < $NumberOfCaches

  GOTO Position=top

  MACROFLAG Type=set Range=1

  MFILTER IF=$d_MacroFlag

  MOVECOPY Settings=<macro>

  SORT By="distance"

  FILTER Name="Cache Raid"

  GOTO Position=top

  CENTER

  SET $j = $j + 1

ENDWHILE 

 

################################

# Finally select the chain 2 database and sort in natural order

DATABASE Name="chain2"

SORT By="natural"

GOTO Position=top

# Show all distances from starting point

CENTER

# put back in natural order (may have changed to distance after Center command)

SORT By="natural"

 

##############################################################

# embeded settings

 

<data> VarName=$Chain1

[TfmMove]

cbxDestination.Text=chain1

rbtAdd.Checked=True

rbtAddFlag.Checked=False

rbtAddIgnore.Checked=False

rbtCopy.Checked=True

rbtExistIgnore.Checked=False

rbtFlagOnly.Checked=False

rbtMove.Checked=False

rbtReplace.Checked=True

rbtReplaceFlag.Checked=False

chkDisplay.Checked=False

<enddata>

 

<data> VarName=$Chain2

[TfmMove]

cbxDestination.Text=chain2

rbtAdd.Checked=True

rbtAddFlag.Checked=False

rbtAddIgnore.Checked=False

rbtCopy.Checked=False

rbtExistIgnore.Checked=False

rbtFlagOnly.Checked=False

rbtMove.Checked=True

rbtReplace.Checked=True

rbtReplaceFlag.Checked=False

chkDisplay.Checked=False

<enddata>

Link to comment

It worked! I just downloaded the one macro and overwrote the older one on my computer.

 

I selected (hilighted) one cache and then clicked on the M1 in my toolbar and all kinds of things started happening.

 

I ended up with 20 caches in a database called chain2. There was also a database called chain1. My Main Database has a total of 2170 caches (125 found and 132 unavailable/archived), and chain1 has 1896 caches in it.

 

Why do I have the chain1 database? The numbers don't add up (2170 minus 125 minus 132 = 1913 not 1896) if the macro is taking my Main Database and first subtracting out my filter requirements to create chain1 and then I guess the macro takes my 20 caches to create chain2 from chain1?

 

Thanks so much for helping me understand the inner workings of macros a little better. Years and years ago I wrote some macros as a secretary using WordPerfect, but I have forgotten all I knew about doing that. Perhaps I should experiment with macros for GSAK, any tutorials out there that anyone can suggest?

 

Thanks!

TeddyTexas ;)

Link to comment
It worked! I just downloaded the one macro and overwrote the older one on my computer.

 

I selected (hilighted) one cache and then clicked on the M1 in my toolbar and all kinds of things started happening.

 

I ended up with 20 caches in a database called chain2. There was also a database called chain1. My Main Database has a total of 2170 caches (125 found and 132 unavailable/archived), and chain1 has 1896 caches in it.

 

Why do I have the chain1 database? The numbers don't add up (2170 minus 125 minus 132 = 1913 not 1896) if the macro is taking my Main Database and first subtracting out my filter requirements to create chain1 and then I guess the macro takes my 20 caches to create chain2 from chain1?

 

Yes, GSAK needs to create the temporary database Chain1 so it can move the waypoints to Chain2 (we don't want to move them out of your main database)

 

Just consider Chain1 a working database and you can ignore it (The macro deletes it next time you run it anyway)

 

However, looking at the code I notice some of the new features introduced in V6 would enable this to be done without using the Chain1 temporary database. This would also make the macro quicker.

 

I will look at changing this and when done will post a note here

Link to comment

I have had great help from the documentation from the GSAK homepage here Automating GSAK (Macros) and looking at the macros delivered with GSAK.

 

I have made a macro that

  • 1. selects a database,
  • 2. then it checks if theres a GPX-file in a predefined directory and if there is imports the GPX-file,
  • 3. if it imported a GPX-file it exports a custom CSV-file made with GPSbabel (had to download GPSbabel and look at the documentation there, but it works),
  • 4. this is repeated for 11 databases in GSAK,
  • 5. if any new CSV-files was generated it calls my FTP-program with a script-file that uploads the CSV-files to my homepage,
  • 6. and finally calls Internet Explorer and puts me at the page where I can import the uploaded CSV-files to a MySQL database.

All this leads to 11 different kml-files for Google Earth that makes Network Links to show the geocaches in the area you are looking at in GE. This is for the 11 Nordic and Baltic countries including Greenland, Iceland and the Faroe Islands.

 

Take a look here if you would like to see the result of this.

 

The macro capability of GSAK has made this updating task a lot easier.

 

ProsperoDK/René

Link to comment
3. if it imported a GPX-file it exports a custom CSV-file made with GPSbabel (had to download GPSbabel and look at the documentation there, but it works),

 

Note: GSAK version 6 introduced several ways to build custom CSV files. For a quick and easy way see "File=>Export=>CSV or TXT". If you want absolute control and flexibility of the generated CSV file check out the TEXTOUT function in the Macro language.

Link to comment
Note: GSAK version 6 introduced several ways to build custom CSV files. For a quick and easy way see "File=>Export=>CSV or TXT". If you want absolute control and flexibility of the generated CSV file check out the TEXTOUT function in the Macro language.

Thanks for the heads up on that ClydeE, this macro was made before v.6 so I didn't see that possibility, but I will check it out, perhaps its faster than GPSbabel.

 

And thank you for GSAK, its a great program!!

 

ProsperoDK/René

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...