Sometimes the number of tabs I have open in Safari gets ahead of me, and I find myself with a few dozen sites waiting for my attention but I’m out of time. Or perhaps I’ve got several tabs open for a current project I’m working on but I need a break from working on that project. Or maybe I’ve got so many tabs open that Safari starts taking up more than its fair share of CPU resources.

Well, here’s a clever little AppleScript that grabs all the open tabs in Safari’s frontmost window and creates a new to-do item in your OmniFocus Inbox with the Title and URL of each tab listed out within the task’s note.

This script is far easier and faster than Instapapering or otherwise bookmarking them one by one. (And yes I know that I can reopen the windows from the previous session, but sometimes that’s not practical, desirable, or possible.)

Since I use Command+4 to clip the current URL into its own OmniFocus Quick Entry panel, I set this other script to execute via Keyboard Maestro when I hit Option+4 if Safari is the frontmost application.

Moreover, since I like confirmation when a script has been successfully executed, I added this Growl notification to the end:


tell application "Growl"
    set the allNotificationsList to {"Success Notification", "Failure Notification"}
    set the enabledNotificationsList to {"Success Notification", "Failure Notification"}
    
    register as application ¬
        "Safari Tabs to OmniFocus Script" all notifications allNotificationsList ¬
        default notifications enabledNotificationsList ¬
        icon of application "Safari"
    
    notify with name ¬
        "Success Notification" title ¬
        "Successfully Logged" description ¬
        "All Safari tabs have been sent tot OmniFocus" application name ¬
        "Safari Tabs to OmniFocus Script"
end tell
AppleScript for Sending Frontmost Safari Tabs to OmniFocus