Mar 08
2010
I posted a way to save your Safari tabs to Evernote, which I’ve found is generally a great way to save bookmarks. It syncs automatically to your other computers and your iPhone, and it’s fast and easy. If you really want to highlight a few tabs to make sure you get back to them, you might consider this script, though. Once you’ve saved your entire Safari browsing session for later, close everything except for those special urls, run the code below as a script, and your open tabs will be saved as entries in your InstaPaper account.
There are two “property” lines at the top of the script; edit them to set your Instapaper username and password (if you have one, otherwise, set it to ""). The next section handles everything, iterating through each tab, grabbing its title and url and building a shell command to do a simple curl call to the InstaPaper API.
After that, the rest of the script is a routine for url encoding that I nicked here. It’s called when setting both the _title and _url variables to make the curl call from the shell work. I haven’t tested this extensively yet, but it’s worked for everything I’ve tried. A title with odd characters in it could potentially cause problems. You can always add a shell-escaping routine…
property _user : "yourusername"
property _pass : "yourpassword"
tell application "Safari"
repeat with _tab in tabs of front window
set _title to my urlencode(name of _tab)
set _url to my urlencode(URL of _tab)
set _script to (¬
"curl 'https://www.instapaper.com/api/add?username="¬
& _user & "&password=" & _pass & "&url=" & _url & "&title=" & _title & "'")
set output to do shell script _script
end repeat
end tell
on urlencode(theText)
set theTextEnc to ""
repeat with eachChar in characters of theText
set useChar to eachChar
set eachCharNum to ASCII number of eachChar
if eachCharNum = 32 then
set useChar to "+"
else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and¬
(eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57)¬
and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then
set firstDig to round (eachCharNum / 16) rounding down
set secondDig to eachCharNum mod 16
if firstDig > 9 then
set aNum to firstDig + 55
set firstDig to ASCII character aNum
end if
if secondDig > 9 then
set aNum to secondDig + 55
set secondDig to ASCII character aNum
end if
set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string
set useChar to numHex
end if
set theTextEnc to theTextEnc & useChar as string
end repeat
return theTextEnc
end urlencode
Open this script in your Script Editor.
Mar 06
2010
Another post, quickly and with less explanation…
The fact that Evernote processes HTML so much better than it does plain or rich text got me thinking and tinkering. I use Markdown (actually, MultiMarkdown) constantly, and it does a great job of turning plain text into valid markup. With (Multi)Markdown, even plain text becomes HTML that–when imported into Evernote–retains most of its formatting. To answer your question, no, I’m not obsessed with Evernote, I’m obsessed with problems I think I could solve. It’s unhealthy.
Please note, this requires that you have Fletcher Penney’s MultiMarkdown installed in ~/Library/Application Support/MultiMarkdown, and that the Perl files (MultiMarkdown.pl and SmartyPants.pl) are located in a ‘bin’ subdirectory (which is the default install). If you don’t have MultiMarkdown, you should get it anyway (all the cool kids have it), so head over to the download page and grab a copy. Now, on with the show.
I set this up originally as a TextMate command, intending just to be able to clip code snippets and free-form text to Evernote without thinking too much about it. That worked well, so I modified it to work as a System Service. Specifically, a Snow Leopard service, but I’m providing the Ruby script here and it can be modified for any Mac setup you want.
While it will work just fine on plain text with no markup, it does have a couple of “special” features. If you start a line with a # and a space (e.g.: # This is my header), which is a Markdown convention for a first-level heading, it will use that as the title for the note and strip it out of the text in processing. It only uses the first one it finds, but it will strip out any first-level headers in the selection. I’ll probably modify that later, or just have it leave them in. Also, a line that begins with “tags:” followed by a space and a comma-separated list of words will be split up and used to tag the new note. This is also stripped before processing. It handles spaces in multi-word tags, and odd marks at the beginning or end of a tag, but only one punctuation character, and only at the beginning or end of a tag. The code follows…
Continue reading “A better System Service for Evernote clipping — with MultiMarkdown…”
Mar 06
2010
I primarily use Safari for web browsing, mostly because it’s smoother and faster than Firefox, and the Web Inspector is just as useful as Firebug. As time passes, I end up with a lot of web pages open, and I like to clear out my browser tabs on a regular basis. Safari doesn’t really have a long-term session-saving option, so I save lists of open tabs to various applications. I used to use SafariStand to do this, but it got too buggy and slow for me. I use VoodooPad for it, but I like the sorting and searching option in Evernote, both on my desktop, and synced online and to my iPhone.
As much as I love Evernote, its editor is, well, a hassle. Importing text clippings can strip line breaks and leave you with quite a mess, and cleaning it up is less than pleasant. I’ve found that using AppleScript, HTML and Evernote together allows me to create pretty well-formatted notes from web and text clippings, aside from using Evernote’s PDF features. In most cases—like website clippings—I don’t need or want a full PDF, replete with ads and comments (Clippable was designed with that in mind). The trick when creating a note in Evernote via AppleScript is to use a little HTML to get the basic formatting. Evernote’s AppleScript library provides a command tailored to this purpose.
To demonstrate, I’ll show you how to save your browsing session in Safari as a nicely formatted list in Evernote. For this I set up a new Notebook called “Bookmarks,” and am keeping the markup very simple. Evernote strips most styling from imported HTML, but accepts structural items like headlines, lists, tables, etc., applying its own default formatting to the elements.
Continue reading “Saving Safari browsing sessions to Evernote…”
Feb 26
2010
I’ve pushed out an update to Clippable, for better or worse. In addition to the previously added line number removal for code blocks, it removes spans used in TextMate formatted code and adds some keyboard shortcuts:
- Left arrow: switch to light on dark
- Right arrow: switch to black on white
- Delete key: return to normal formatting
- Escape key: return to original page
These features are added without modifying the original bookmarklet, so if you’ve got it installed, you’ve got the goodies already. Otherwise, head over to the Clippable bookmarklet page and try it out.
The big news, though, is the introduction of Clippable Mobile. It’s a work in progress, but installs on an iPhone and makes use of the special formatting options available in Mobile Safari. It shrinks images, cuts off code blocks, etc., making every attempt to provide a readable page that doesn’t scroll horizontally. There are occasions where it fails on first attempt, but running it again right away fixes everything. I’m still working on figuring out why that happens… a little sleep will probably help. Head over to the Clippable Mobile page on your iPhone and follow the instructions to install it. Bug reports are welcome!
Feb 18
2010
Uploaded by www.cellspin.net
Feb 18
2010
This is a quick test of CellSpin, just to see if it does what I think it will.
Jan 29
2010
I apologize for the recent downtime, which also affected the Clippable bookmarklet’s ability to work. Dreamhost has been pretty awful with downtime lately, and my attempt to switch to a different physical server resulted in a horrible mess for myself and several clients. I have to say that Dreamhost support was extremely helpful in repairing the situation… their support is the main reason I’ve stuck with them through the 4 hours of downtime I’d had up to that point. I’m not sure I’ll be able to swallow much more, but we’ll see if things run as smoothly as they’ve promised from here on out.
In other news, I have a new version of the Songza service–one that doesn’t require any additional libraries–which I’ll post soon. A couple of other little projects are in the works, including a service that interprets natural language dates for various purposes. I’m in Atlanta for a week, then I’ll be in San Francisco covering Macworld for TUAW, so it may be a bit, but I’ll be back!