Process Pocket Queries Automator Workflow

From Calliespedia
Jump to: navigation, search

Every Sunday, I receive in my inbox three pocket queries from geocaching.com, and every Sunday, I spend a couple of hours processing these pocket queries into my Caches to Find FileMaker Database and into my Garmin 60CSx. I finally decided to leverage Apple's Automator software to help reduce that time spent.

Workflow

  1. Receive three emails from geocaching.com, each email contains a pocket query. As soon as they are received, these emails are automatically moved in a mailbox on my MacBook Pro called Pocket Queries.
    • Home (495325), containing geocaches that are:
      • Around my home coordinates
      • Located in Washington State
    • Downtown Portland (610974), containing geocaches that are:
      • Around ZIP code
      • Located in Oregon
    • Portland (1940863), containing geocaches that are:
      • Around ZIP code
      • Located in Oregon
  2. I save the zipped pocket query file attachments to my Downloads folder.
    • 495325.zip
    • 610974.zip
    • 1940863.zip
  3. I open the zipped files in my Downloads folder, resulting in three folders named:
    • 495325
    • 610974
    • 1940863
  4. Each folder contains two gpx files, one gpx file contains the geocaches (495325.gpx, 610974.gpx and 1940863.gpx) and the other gpx file contains any supporting waypoints (495325-wpts.gpx, 610974-wpts.gpx and 1940863-wpts.gpx). In each of the folders, I create a duplicate of the geocaches gpx file, resulting these three duplicate geocaches files:
    • 495325 copy.gpx
    • 610974 copy.gpx
    • 1940863 copy.gpx
  5. For importing geocaches into my FileMaker database, I rename the duplicate geocaches files to:
    • 495325.xml
    • 610974.xml
    • 1940863.xml
  6. I move the geocaches gpx and xml files to a folder called Caches to Find:
    • 495325.gpx and 495325.xml
    • 610974.gpx and 610974.xml
    • 1940863.gpx and 1940863.xml
  7. I delete the following folders in my Downloads folder:
    • 495325
    • 610974
    • 1940863
  8. I open my FileMaker database
  9. I run the Update Home Area Caches script in my FileMaker database.
  10. I sync my FileMaker database to my iPhone 3G, running FMTouch.
  11. I connect my Garmin 60CSx to my MacBook Pro.
  12. I delete all the waypoints on my Garmin 60CSx.
  13. I transfer the new geocache waypoints onto my Garmin 60CSx from the following gpx files:
    • 495325.gpx
    • 610974.gpx
    • 1940863.gpx

Automator Workflow

Open Caches to Find Database.png
  • I open this database at the beginning to allow enough time for the operation to finish. Then the script to update the caches is executed later in the workflow.
Extract Pocket Queries from Mail and Expand.png
  • The Pause action is needed in order to allow for the unzipping operation of the zipped files to complete.
  • Possible Bug: I am noticing that when I open my workflow from the file, the mailbox to look for my pocket queries is always set to my Deleted Messages mailbox rather than my Pocket Queries mailbox despite my efforts to save the workflow with the proper mailbox.
Ignore Previous Input.png

Eureka Moment:

For the longest time, I had been struggling with getting Automator to clear finder items I no longer wanted to work with. For example, I wanted to move one set of files into one folder and then move another different set of files into a different folder. Well, Automator would work with both sets of files. First, the first set of files would be moved into the correct folder, but then both the first and second sets of files would be moved into the second folder. I didn't know how to get Automator to clear or release the first set of files.

After an extensive Google search, I stumbled across the solution. Right click the title of the action of where you want to begin clearing references to previous finder items and select the Ignore Input option.

Duplicate GPX Files and Move to Caches to Find Folder.png
Move GPX Files to Caches to Find Folder and Upload GPX Files to GPS.png
  • Utilizes the now-defunct scriptamac's GPS Automator Actions 1.0.3, which can still be downloaded here.
Delete ZIP Files and Associated Folder.png
Update Home Area Caches in FileMaker.png
Upload GPX to GPS.png
  • Uses the GPS Upload Applescript
  • There is some additional coding in order to take advantage of the Get Specified Finder Items action.
    • The Get Specified Finder Items are passed into the Applescript as input.
    • The repeat loop finds each item in input, which is the specified files and uploads that file into the GPS.

<bookmarking></bookmarking>