Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A Service for adding shortened URLs to Safari's Reading List Web Browsers
Recently, I was playing around with Safari's Reading List feature, and I was pleased to see that there is a Services menu item to add links to the list from other applications. Unfortunately, it didn't work for a bunch of the URLs that I tried to add.

The link detection scheme is overly strict and it seems to only work with well formed URLs that contain the scheme. This didn't help at all when trying to add links from Twitter where just about every one is shortened and does not contain the http:// cruft.

I have been wanting to learn more about Automator and Applescript so without further ado I present my lax version of the 'Add to Reading List' Service.

To setup the service:
  • Launch Automator.
  • Choose the Service document type.
  • Service receives selected text in any application (default).
  • Type apple in the search field to find the Run AppleScript action.
  • Drag Run AppleScript to your workflow.
  • Replace the script contents with the code given below.
  • Save and give the Service a name
  • Assign a keyboard shortcut with System Preferences » Keyboard » Services.
Here's the script:
--
-- Automator Service - Add to Reading List - lax version
-- 
-- http://warmfuzzyapps.com/2011/07/add-to-reading-list-lax-version/
-- Wiley Wimberly
--
-- The default service that adds links to Safari's Reading List is a
-- bit on the strict side when deciding what constitutes a URL and it
-- doesn't work well for adding shortened URLs from apps like twitter.
-- This version is more tolerant and will prepend http:// if the  
-- selected text does not already start with http:// or https://.
--
-- Service receives selected text in any application.

on run {input, parameters}

    set theItem to item 1 of input

    if theItem starts with "http://" or theItem starts with "https://" then
        set theUrl to theItem	
    else
        set theUrl to "http://" & theItem
    end if

    tell application "Safari"
        add reading list item theUrl
    end tell

    return theUrl

end run

From this blog post. The code is also listed here.

[crarko adds: This pretty much just reformats the URL so Safari will be happy with it.]
    •    
  • Currently 2.50 / 5
  You rated: 5 / 5 (4 votes cast)
 
[5,636 views]  

A Service for adding shortened URLs to Safari's Reading List | 0 comments | Create New Account
Click here to return to the 'A Service for adding shortened URLs to Safari's Reading List' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.