vb:literal>

Results 1 to 3 of 3

Thread: Handling your Pocket Queries via GSAK Macros

  1. #1
    Join Date
    Aug 2005
    Location
    Maine
    Posts
    539

    Default Handling your Pocket Queries via GSAK Macros

    If all goes well, this will take you through the steps needed to automate GSAK’s handling of Pocket Queries. The first thing you need to do is set up your pocket queries on Geocaching.com.

    Several times a week I update all unfound caches in Maine and New Hampshire. Depending on the day of the week I have between 2 and 5 PQ’s that are generated by GC.com. Once you have your PQ’s set up properly and your receiving the information your looking for your ready to tackle the GSAK settings.

    First you need to create the directory that will handle your PQ Zip Files. I have a directory C:/temp/geomail that I use for all my geomail zip file work. Create it and name it what ever you want, just make sure you know where the directory is and what you have named it.

    Now open GSAK and go to the File section and click on Load/GPX/LOC/ZIPFILE tab. Use the following screenshot to help you fill in the necessary information.

    See Attactment 1: PQsLoadandDelete

    Once you have the setting as listed with your particulars filled in be sure to save it as PQsLoadandDelete or whatever you want to name it. Be sure to click the Save Tab.

    You next need to set up your GetMail settings in GSAK. Click on File/Get Data via Email.

    I use a Google Mail account (IT’S FREE!) because Google mail handles files in a way that makes this work best. I tried Outlook and had problems. So I recommend the Google Gmail route.
    In registering and opening your google mail account give it a unique name. I used my geocaching handle.gsak.notify. When you have that all set you have to configure your forwarding information. You can use either POP or IMAP Mail in Gmail (IMAP is a new format – I use this and it works very well)!

    For POP Click on Configuration Instructions in your Gmail account. Select your email client from the list and follow their recommendations.

    For IMAP do the same if that is the forward format you decide to use. As I said I use Outlook2007. Just make sure you set up according to the directions they put forth there for your email client.

    Now back to GetMail in GSAK. Here is the screen shot of the GetMail settings:

    See Attachment 2: movePQtoHome

    As above be sure you save the GetMail setting by clicking on Save and naming it in my case movePQtoHome.

    Now you need the Macros that make all the important things happen.

    Here is the first Macro: You need to cut and paste (the stuff between the two +++++ lines) into the Macro Directory in GSAK naming it - GetMail_Delete_Archive.gsk

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++

    #*******************************************
    # MacVersion = 1.1
    # MacDescription = Run GETMAIL to grab PQ, Delete caches not included as they are archived.
    # MacAuthor = KFBradley
    # MacFileName = GETMAIL,Delete Archives.gsk
    # MacUrl =http://gsak.net/board/index.php?showtopic=6867&view=getlastpost
    #*******************************************

    GETMAIL Settings="movePQtoHome"

    LOAD Settings="PQsLoadandDelete" Database="home" ShowStats=No

    MACRO File="C:\gsak\macros\UpdateArchiveInactive.gsk"

    EXIT

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++

    Now for the 2nd Macro: Again cut and past (the stuff between the two +++++ lines) into the Macro Directory in GSAK naming it – UpdateArchiveIncactive.GSK

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++

    # MacDescription = Unknown
    # MacFileName =updatearchiveinactive.gsk
    # MacAuthor = Unknown
    # MacVersion=0.0

    ################################################## ###########
    # Macro to automate "cleaning up" your database by setting #
    # up to three different cache statuses (archived, #
    # temporarily unavailable or found) for deletion. #
    # #
    # Note: this macro will delete the specified caches from #
    # your currently selected database. Be sure that you're in #
    # the database you want to clean up BEFORE running this #
    # this macro! #
    # #
    # The first time it's run, this macro will ask you to #
    # identify the status of the caches you want to delete. It #
    # will store this information in a file called #
    # "CleanUpData.dat" in the GSAK\Macros folder so that #
    # you don't have to answer the questions again. If you #
    # want to change this information later, delete the #
    # CleanUpData.dat file and run the macro again. #
    ################################################## ###########

    VerCheck Version=7.1.2.30 (please update GSAK to the latest version to run this macro - see http://gsak.net)

    # Set the file path
    $datafile=$_Install + "\Macros\CleanUpData.dat"

    # Does it already exist?
    IF (FileExists($datafile))

    # Yes? Read config values and assign to variables
    FILEREAD File=$datafile
    $Archived=EXTRACT($line, ";", 1)
    $TempUnavailable=EXTRACT($line, ";", 2)
    $Found=EXTRACT($line, ";", 3)
    ENDREAD

    ELSE

    # No? Ask for the status of cahces you want to delete.
    # Delete Unfound Archived?
    $inputmsg="Do you want to delete all archived caches that that you haven't found? (Y/N)"
    INPUT Msg="$inputmsg" Default="Y" Varname=$Archived

    # Delete Temporarily Unavailable?
    $inputmsg="Do you want to delete all temporarily unavailable caches that you haven't found? (Y/N)"
    INPUT Msg="$inputmsg" Default="Y" Varname=$TempUnavailable

    # Delete Caches You've Found?
    $inputmsg="Do you want to delete ALL caches that you've found? (Y/N)"
    INPUT Msg="$inputmsg" Default="Y" Varname=$Found

    # Now save those database values for next time into $datafile, separated by ";"
    $vars=$Archived + ";" + $TempUnavailable + ";" + $Found
    $result=PUTFILE($datafile, $vars)
    IF Left($result, 7) = "*Error*"
    CANCEL Msg="Unable to write to $datafile!"
    ENDIF
    ENDIF

    # Filter for the desired cache status to delete
    IF $Archived="Y" and $TempUnavailable="Y" and $Found="Y"
    MFilter IF=$d_archived or $d_TempDisabled or $d_Found
    ENDIF

    IF $Archived="Y" and $TempUnavailable="Y" and $Found<>"Y"
    MFilter IF=(not ($d_Found) and $d_archived) or (not ($d_found) and $d_TempDisabled)
    ENDIF

    IF $Archived="Y" and $Found="Y" and $TempUnavailable<>"Y"
    MFilter IF=$d_archived or $d_Found
    ENDIF

    IF $TempUnavailable="Y" and $Found="Y" and $Archived<>"Y"
    MFilter IF=$d_TempDisabled or $d_Found
    ENDIF

    IF $Archived="Y" and $TempUnavailable<>"Y" and $Found<>"Y"
    MFilter IF=(not ($d_Found) and $d_archived)
    ENDIF

    IF $TempUnavailable="Y" and $Found<>"Y" and $Archived<>"Y"
    MFilter IF=(not ($d_found) and $d_TempDisabled)
    ENDIF

    IF $Found="Y" and $Archived<>"Y" and $TempUnavailable<>"Y"
    MFilter IF=$d_Found
    ENDIF

    #Test to insure there are waypoints in the filter and delete if found
    IF $_FilterCount > 0
    MacroSet Dialog=Delete VarName=$Delete
    DELETE Settings=<macro>
    ELSE
    PAUSE Msg="No waypoints in filter, action cancelled"
    ENDIF

    <data> VarName=$Delete
    [TfmDelete]
    cbxStop.Checked=False
    rbtFilter.Checked=True
    rbtFlagged.Checked=False
    rbtOnly.Checked=False
    <enddata>

    ++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++

    Now your ready to run the whole Macro. You start by testing it in stages.

    First run your Get Mail via Email from GSAK. If it completes without stopping or generating an error message then your setting are all OK.

    Second run your Load GPZ/LOC/ZIPFILE called PQsLoadandDelete. Click OK.

    No go to your Gmail Account and un-archive the PQ’s you just ran.

    Make a Macro Button in GASK and add it to your Menu Bar naming it “Get Mail/Pocket Queries” and point it to the GetMail_Delete_Archives.qsk macro in the GSAK Macro Directory. If you have done it all correctly you should be able to click the Macro Button you just created and watch the whole macro run and exit GSAK.

    You handle all your Pocket Queries with just the click of one button.

    If you get error messages or if the macro aborts you need to make sure it actually has a Pocket Query in the Google Mail Account.

    I will help you if you need help.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	PQsLoadandDelete.jpg 
Views:	438 
Size:	20.5 KB 
ID:	260   Click image for larger version. 

Name:	MovePQtoHome.jpg 
Views:	453 
Size:	14.8 KB 
ID:	261  
    I'd really rather not cache, but I am helpless in the grip of my compulsion!

  2. #2
    Join Date
    Aug 2005
    Location
    Maine
    Posts
    539

    Default

    I know the screenshots are small, if anyone needs them drop me a note and I will email them to you.

    Better yet, if there is a better way to handle the attachment files please let me know as I may not have done it correctly.
    I'd really rather not cache, but I am helpless in the grip of my compulsion!

  3. #3
    Join Date
    Aug 2005
    Location
    Maine
    Posts
    539

    Default

    There have been some changes since I wrote this. I have tried to update things. Please see the latest post on the matter.
    I'd really rather not cache, but I am helpless in the grip of my compulsion!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •