There are at least two ways to run bookmarklets in Chrome via LaunchBar:
- Through Menubar Search
- With a custom action using AppleScript
Method 1 is perhaps the easiest but requires more typing than the second method. Also, it requires that bookmarklets are actually present in the browser. With the second method, that won’t be necessary as you are going to use the bookmarklet code in the AppleScript.
- Install Launchbar Menubar search Launchbar action. I have zipped up the
Menubar Search.lbactionand uploaded it here.
- [Optional] Set a custom abbreviation, say
Mfor Menubar Search in LaunchBar.
- When Chrome is the active window, to run a bookmarklet, bring up Menubar Search in LB, press Space or Return and begin typing the name of the bookmarklet.
Ex.: To bring up my bookmarklet to bookmark the current page in Pinboard, I would type
pin, arrow to it and hit Return.
- Bring up Action Editor (start typing A C T I O N in LB).
- Create a new action. Fill in the details in General section.
For the icon, you could do a google search or locate the logo on product/service official website, drag and drop it in.
- In the Scripts section, select AppleScript and enter this sample code in it:
You need to replace
with the cleaned up version of your bookmarklet code.
First get the bookmarklet code by editing it.
Now we need to take care of encoding from the bookmarklet code.
This can be done in two ways:
a) Use LaunchBar’s built-in
Remove Percent Encoding action.
b) Go to http://www.yellowpipe.com/yis/tools/encrypter/index.php, paste the code, select
HTML Entities Encode and press OK. The code you need is given under Result.
- Once you’ve the action ready, either bring it up in LaunchBar and execute it or better yet, set (⌘⌥A) and use an abbreviation for it.