Sunday, May 3, 2009

update: GPSMAP 60CS - Refining one of my tools

Last night I had posted a question on how to fix the date to 2 characters in the strings I posted below and got the method I posted from Clyde, author of GSAK.

I just checked the thread again and KAI team posted what I think is a better method that gives the option of leaving out the "/" to give even more real estate. The thread can be found here however the specific message I am reposting here.



From KAI Team
posted 3-MAY-09 1017 CDT

%macro gives you the most control over the format of the dates you send and won't slow the export that much (the 60CS only holds 1000 waypoints, after all). If you want to use %macro, go to Macro>Edit/Create and copy and paste the following code into the macro editor:

CODE
$DateString=DateToString($d_LastFoundDate)
$Year=Substr($DateString,3,2)
$Month=Substr($DateString,5,2)
$Day=Substr($DateString,7,2)
$_Special=$Month + $Day + $Year

Go to File>Save in the macro editor and give this macro a name (let's call it "60CSDates.gsk", without the quotes).

Now anywhere you want the date to appear in your 60CS export, just enter:

CODE
%macro="60CSDates.gsk"

You have to use the double quotes around the file name in this case.

This code will produce the smallest possible date in mmddyy format, e.g.: "050309" for today's date. If you want to change the date format, just edit the line that begins with "$_Special". For example, to add slashes as separators (mm/dd/yy), change $_Special to:

CODE
$_Special=$Month + "/" + $Day + "/" + $Year

If you want to change the year to 1 digit (not recommended, since 2010 is closer than we think), modify the $Year line to:

CODE
$Year=Substr($DateString,4,1)


The raw $DateString format is YYYYMMDD. If you want to play around with different formats, just go to Macro>Help in GSAK, click on Commands and Functions, and view the help for SubStr to learn how to modify what's extracted from the master Date String. smile.gif

1 comment:

  1. Thanks for posting this. I love learning new tricks and techniques. You have been able to find another useful new trick.

    ReplyDelete