Jump to content

Gsak Macro Developement


OmniCitadel

Recommended Posts

Ok so let me tell you what i want to do and you can tell me if it is possible or not. I want to develope a macro which runs certain filters and then exports them to my sd card reader and my sync folder for pocket pc with certain names. It seems like it should be fairly easy but i dont know the limitiations of this program.

 

If it is possible can some one please point me in the right direction to learn how to program macros for gsak.

 

If it is not possible can come one please point me in the right direction to learn how to program macros for gask.

Link to comment
Ok so let me tell you what i want to do and you can tell me if it is possible or not. I want to develope a macro which runs certain filters and then exports them to my sd card reader and my sync folder for pocket pc with certain names. It seems like it should be fairly easy but i dont know the limitiations of this program.

 

If it is possible can some one please point me in the right direction to learn how to program macros for gsak.

 

If it is not possible can come one please point me in the right direction to learn how to program macros for gask.

Yes, you can do this via the macro language.

 

To check out some existing working macros see http://gsak.net/Macros.php

 

For a complete overview of the macro language please see "Automating GSAK" in the help file or online here http://gsak.net/help/hs21000.htm

Link to comment

CENTRE Location="Home"

sets your center point and sorts records by distance from that point. You of course would need to have a named location - see the Tools Menu/Options/Locations. I have

Home, N 47 30.967, W 122 36.474

as one of my saved locations, and can then center on my home location prior to exporting to the GPS or whatever.

Link to comment
awesome that helps ... i got it working but i would like to know how to set the export Number to 200 caches per file any ideas?

Here's what I do to get the approximate number of caches in each file: run a GSAK filter with the "Distance less than or equal to" the number of miles that gives me the correct number of caches. Then I save that filter. I also save a companion SETTINGS file to create Magellan SD files and also gpx files for download to my ppc.)

 

Finally - you need to add each location's coordinates to the location file.

 

Then I run my macro - exactly like you described - for each city or sub-city between Sacramento and Fresno (about 200 miles total.)

 

The macro looks like this:

 

(Note the numbers after the cities is the number of miles needed to approximate 200 finds that a.) are active, and b.) I haven't found.)

 

FILTER Name="Merced_44"

EXPORT Type=MAGSD Settings="Explorist gs Merced_44"

EXPORT Type=GPX Settings="gpx Merced_44"

#

FILTER Name="Modesto_30"

EXPORT Type=MAGSD Settings="Explorist gs Modesto_30"

EXPORT Type=GPX Settings="gpx Modesto_30"

#

FILTER Name="Turlock_38"

EXPORT Type=MAGSD Settings="Explorist gs Turlock_38"

EXPORT Type=GPX Settings="gpx Turlock_38"

#

FILTER Name="Sacramento_8"

EXPORT Type=MAGSD Settings="Explorist gs Sacramento_8"

EXPORT Type=GPX Settings="gpx Sacramento_8"

#

and on and on for each area.......

Edited by Photom
Link to comment

Is there a way to create a string like [a,b,c,d,e] as displayed in this javascript snipplet:

 

function calc_premium() {

 

var pprices = [12, 23, 33, 41, 48];

var pcounter = -1;

 

var bill_hbo_checked= window.document.frmBot.elements["bill_hbo"].checked;

var bill_show_checked= window.document.frmBot.elements["bill_show"].checked;

var bill_starz_checked= window.document.frmBot.elements["bill_starz"].checked;

var bill_cine_checked= window.document.frmBot.elements["bill_cine"].checked;

var bill_sports_checked= window.document.frmBot.elements["bill_sports"].checked;

 

if (bill_hbo_checked == true) {

pcounter++;

}

 

if (bill_show_checked == true) {

pcounter++;

}

 

if (bill_starz_checked == true) {

pcounter++;

}

 

if (bill_cine_checked == true) {

pcounter++;

}

 

if (bill_sports_checked == true) {

pcounter++;

}

 

if (pcounter >= 0) {

return pprices[pcounter];

}

else {

return 0;

}

 

}

 

I am trying to cut down this script in gsak:

 

IF $Count = 1

$Loc = $a

ENDIF

 

IF $Count = 2

$Loc = $b

ENDIF

 

IF $Count = 3

$Loc = $c

ENDIF

 

IF $Count = 4

$Loc = $d

ENDIF

 

IF $Count = 5

$Loc = $e

ENDIF

 

so that i can say:

 

$Loc=["a","b","c","d","e"]

so that:

$Loc[1] = "a"

$Loc[3] = "c"

Edited by OmniCitadel
Link to comment

There's currently no support for arrays and array operations in the GSAK macro language. However, you can probably do what you want with the SUBSTR function:

$locs = "abcde"
$num = 3
$loc = SUBSTR($locs, $num, 1)

should set $loc to "c".

 

The EXTRACT function would also allow you to do something like that - see the GSAK help page on internal functions.

 

I may have dropped some quotes or something in the above code so it may not work if you cut and paste it. It's 2:40am Christmas morning and I should really be in bed. Hope that helps - happy holidays.

Link to comment

There is currently no native support for arrays in the GSAK macro language.

 

However, you can have "seudo" arrays by using a string variable with the extract function. For example:

 

$containers = "Micro~Small~Regular~Large"

 

Now you "extract" any item for this string via:

 

$temp = Extract($containers,"~",3)

 

$temp now equals "Regular"

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...