Last active
August 29, 2015 14:01
-
-
Save adamwalz/27943f597ea759167fca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
------------------------------------------------------------------------------ | |
-- FILE: pocket_to_evernote_clipper.scpt | |
-- DESCRIPTION: Imports all clips from Pocket into Evernote through the | |
-- Evernote Web Clipper for Safari | |
-- AUTHOR: Adam Walz <[email protected]> | |
-- VERSION: 1.1.0 | |
-- | |
-- This script takes a file containing a list of urls, one per line, and | |
-- imports the urls into Evernote by similuating use of the Evernote Web | |
-- Clipper for Safari. The list of urls can be found by using the Pocket | |
-- export tool. | |
-- | |
-- By default, the script uses the Clearly ("Simplified Article") style in the | |
-- Clipper, but this can be changed. It is also possible to change this script | |
-- from using Safari to using Chrome. | |
-- | |
------------------------------------------------------------------------------ | |
set clippingStyle to "C" -- Clearly simplified article | |
-- set clippingStyle to "A" -- Full article style | |
-- get the text file containing all urls to clip | |
set urlListFile to choose file | |
set urlList to paragraphs of (read urlListFile) | |
tell application "Safari" | |
activate | |
make new document | |
end tell | |
repeat with currentUrl in urlList | |
tell application "Safari" | |
set URL of front document to currentUrl | |
delay 2 | |
end tell | |
tell application "System Events" | |
tell process "Safari" | |
keystroke "`" | |
delay 1 | |
keystroke clippingStyle | |
delay 1 | |
key code 36 | |
delay 4 | |
end tell | |
end tell | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script is conservative with its use of delay. I don't know is the delay times are too long, so feel free to change them.