Sharing with PowerMate
I like to keep the Bookmarks bar hidden in Chrome. I tend to not really use bookmarks much, although every so often I need to use a bookmarklet to send something to Instapaper, Delicious, Pinterest, etc. By the way Pinterest is actually pretty handy for collecting little user interface snippets that I like. Anyway, I didn’t want to click on the Bookmarks menu, but I also don’t want a row of 24, or so, useless pixels always sitting at the top of my browser.
What to do?
I don’t know why I didn’t try this sooner. PowerMate can open a URL, but that doesn’t really work with a javascript URL sadly. But! Both Chrome and Safari allow the execution of javascript via AppleScript. I have no idea about Firefox or any others, I didn’t bother to check. Anyway, it would be great if I could just bop the PowerMate whenever I have something I win to pin / save / tweet / share, etc. So I created a PowerMate trigger with a custom AppleScript that looks like this (this one demonstrates posting to Pinterest):
tell application "Google Chrome" execute active tab of window 1 javascript "void((function(){var e=document.createElement('script');e.setAttribute('type','text/ javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/ pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)})());" end tell
So perhaps that looks like gobbledygook to you. It pretty much does to me too. So I created a PowerMate set file that demonstrates using bookmarklets with PowerMate in a couple of different ways for both Chrome and Safari. A normal click with no modifiers will pin to Pinterest. A normal click with the control key held posts to Twitter. And a long press will open a menu letting you pick from Twitter, Facebook, Instapaper, and Delicious. There should be enough there to demonstrate how to configure these bookmarklets however you like.
Oh there is one little wrinkle. The Instapaper is customized for each account so you’ll need to do a bit of editing there. Just replace the ID in the script with the ID found in your Instapaper bookmarklet.
The PowerMate set file can be downloaded here. Just unzip, drop it in the PowerMate app, and configure as needed.