Put the current Chrome URL in your Safari reading list

November 5th, 2011  |  Published in mac and iphone, ruby  |  5 Comments

… or “Hey, dawg, we heard you like Safari so we put your Chrome in your Safari so you can Safari when you’re done Chroming!”

safari_service_menu

I tend to do desktop surfing with Google Chrome because I do a lot of “open 10 tabs at the same time” stuff on our Drupal multi-site and Safari’s not very good at that. Sometimes, when it’s time to head downstairs for lunch or by the fireplace for some iPad surfing, I find myself wanting to take a few things I had open in Chrome with me on the iPad. I used to use Pinboard, but Safari’s new reading list is more convenient and doesn’t clutter up Pinboard with short-lived links, so it’s cool that there’s an AppleScript command to add things to it:

And here’s one that does the same thing with the selected NetNewsWire headline:

Hook them up to the actual apps to taste.

I made the mistake of writing a quick Automator workflow that created a Service Menu item to do the same thing with any selected URL in any app, but when I went to try out my new service I noticed Apple had already thought of that. Easier to go into System Preferences and create a shortcut for it.

If you don’t mind the extra keystrokes, you could also just ⌘l then ⌘c to get Chrome’s current URL and use the service, no need for AppleScript at all, but I wrote it all before I realized Apple had done it for me.

What about Firefox?

No real scripting support because Firefox is lame like that and always has been. You can get the current Firefox URL by using AppleScript to press ⌘l then ⌘c:

Yuck.

Responses

  1. Pdsn says:

    March 27th, 2012 at 12:43 pm (#)

    how do you implement this in chrome?

  2. Nobody says:

    May 3rd, 2012 at 10:17 am (#)

    This is not AppleScript. This is ruby that uses the appscript binding. How’sa bout you just use applescript?

    tell application “Google Chrome” set myURL to get URL of active tab of first window set myTitle to get title of active tab of first window end tell

    tell application “Safari” to add reading list item myURL with title myTitle

  3. m. hall says:

    May 3rd, 2012 at 12:40 pm (#)

    Thanks for the AppleScript version, nobody.  

    I don’t use AppleScript because once I get past the simple things, I don’t find it  a very comfortable language.  Since I tend to reuse a lot of bits of the scripts I write, I prefer to start from Ruby/appscript: Small things help me learn how a given app and its objects work in Ruby. Once it’s time to do something more complex, I’ve already got the basics in the language I prefer to write in. 

  4. mosko says:

    August 30th, 2013 at 9:37 pm (#)

    I dumb question, how do you “Hook them up to the actual apps”. I’d like to make this work from within Chrome?

  5. Sean Ouimet says:

    November 12th, 2013 at 10:26 am (#)

    For those wanting to implement this as a service/shortcut see http://veritrope.com/tech/the-basics-using-keyboard-shortcuts-with-applescripts/

Leave a Response

© Michael Hall, licensed under a Creative Commons Attribution-ShareAlike 3.0 United States license.