Request for help in making an automated workflow

So my job is moving, and while I’m not 100% sure I’ll be moving with it, I do want to explore my options, which include finding possible apartments until I decide.
My workflow looks like this:

  1. Use saved search in local (Norwegian) apartment hunting website
  2. Look at apartment
  3. If I like the apartment, copy the address
  4. go to Google Maps
  5. Paste apartment address
  6. Select the directions button
  7. type Work [1]
  8. Usually just wait for it to load, but sometimes I do need to select the public transport option in case I was doing something else on google maps before this

I do this perhaps ten times per session, several sessions per week, so I thought I’d try to automate it.

I suspect I could make a javascript bookmarklet which gets the address from the CSS on the apt hunting site and automatically search google, but seeing as I’m not very good with javascript, that very quickly ended up being plan B, if not C.

First I tried with Keyboard Maestro, which I haven’t actually used before. I ended up searching for the direction between “Wait For Safari to FiniWork” to “Your loca”, but like – really quickly.

I futzed about for half an hour trying to make this work, but I’d like to hear if I’m barking up the wrong tree. Is there an obvious solution I’m missing?

[1]: Since I can’t have two addresses in the clipboard at the same time, I “moved” my work address for this. I’m using Alfred, so obviously I could have tons of address in the clipboard history and switch between them, but that adds complexity when automating.

One option would be to use a scriptable browser like Fake.app . But given that you have Alfred, I’d create a workflow with a trigger passing the current selection as argument, and pipe it to a script to open a customized Google Maps directions URL.

Update: I vaguely remembered answering this question in the Alfred forums - five years old but it should work: https://www.alfredforum.com/topic/1725-mileage-tracker/?do=findComment&comment=8894

(change the input from a contact action to get selected text as described above)

1 Like

Did a quick Keyboard Maestro macro.

The workflow:

  • Mark an address in the browser (or anywhere else)
  • Press a hot key
  • Work address is stored in the macro and possible routes to your work are shown.

So, how do I do that:

Macro is here: http://www.oe1exa.com/temp/gomaps.zip

While building TheURL, change the TLD to your contry and, of course, use your address in MyWork.

Just did some quick&dirty tests, but it works for me.

2 Likes

Good idea. I tweaked it further, and just added a search engine in Alfred with this URL:
https://www.google.com/maps/dir/?api=1&origin={query}&destination=Work&travelmode=transit

This adds a step, as I have to first copy, then open Alfred, then type the keyword, then paste, but it works!

1 Like

It still doesn’t work. It pastes and moves weirdly… It might be something wrong with my extensions, but I only have two - uBlock Origin and 1Password.

If I had the Mojave beta this would be a perfect excuse to make one of those quick screenshot videos.

Also adapted the Alfred thing:

  • make a new workflow
  • use a Hotkey trigger (Action: Pass through, Argument: Selection in macOS)
  • join it with an action: Open URL (use the {query})
  • just mark an address, press the hotkey, done
1 Like

Sadly, VBA in Excel for macOS is lacking some stuff…I did an VBA thing on Excel for Windows that implemented a “lookup distance” function. Nice if you have a list of addresses…no idea how to get it working on Excel for macOS.

Yep!
I think this is the final production release of my new workflow :slight_smile:
Thanks everyone!