Skip to content

Instantly share code, notes, and snippets.

@rempargo
Forked from pdxmph/save_chrome_url.rb
Last active August 29, 2015 14:11
Show Gist options
  • Save rempargo/29f092c28adef3a0f96c to your computer and use it in GitHub Desktop.
Save rempargo/29f092c28adef3a0f96c to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -wKU
require "rubygems"
require "appscript"
include Appscript
chrome = app("Google Chrome")
safari = app("Safari")
chrome_tab = chrome.windows[1].active_tab
save_url = chrome_tab.URL.get
save_title = chrome_tab.name.get
safari.add_reading_list_item(save_url, :with_title => save_title)
@rempargo
Copy link
Author

But this in Applescript is much better:
In Alfred's Workflow, add Actions then Run Script
Select as language /usr/bin/osascript

tell application "Google Chrome"
set pageUrl to get URL of active tab of first window
end tell
tell application "Safari" to add reading list item pageUrl

The only thing was, I didn't realised it worked allready, no signs of this process in the screen (like you would see with a typical GUI macro recorder => selecting URL, switch to safari, etc...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment