Setting up LaunchBar search template for multiple sites

17 04 2008

Let’s say you want to search for something simultaneously on multiple web sites. You could use Saft (and chase after the latest version every time Apple release an update), or, if you are a LaunchBar user (which you should be!) setup a AppleScript like so:

on handle_string(s)

tell application “Safari”

activate

 

tell application “System Events”

tell process “Safari”

keystroke “n” using command down

end tell

end tell

delay 1

set the URL of document 1 to “http://www.google.com/search?hl=en&q=” & s

 

tell application “System Events”

tell process “Safari”

keystroke “t” using command down

end tell

end tell

set the URL of document 1 to “http://search.yahoo.com/search?p=” & s

 

end tell

 

end handle_string

 

After LaunchBar indexed the script you can trigger it as a search template. The script will open a new Safari

window with two tabs, showing the results from Google and Yahoo





A digital Fax for your desktop

4 04 2008

Often times I need to make a quick screenshot, maybe to compare something, or just to keep a reminder around. My workflow goes something like this:
1. press hotkey (Cmd-Ctrl-Shift 4)
2. locate screen capture file on the Desktop
3. open it in Preview

Here a little script which, when executed will perform the screen capture, and open the saved file in Preview:

#!/bin/csh
rm -f /Users/your_username/grab.jpg
screencapture -i /User/your_username/grab.jpg
open /Applications/Preview.app /Users/your_username/grab.jpg

Make sure to chmod +x the file so it is executable. This is really a simple, single-purpose script – one could extend its functionality by numbering the screen captures to preserve older ones.

Using a launcher application, preferably LaunchBar, to execute the script. You can also use OS X’s Spotlight search to start the script.

You should see your mouse pointer turning into a crosshair. Click-drag the area on the screen you like to capture. Now Preview should open you captured image. You just send yourself a digital fax! (woot 21st century!)

Here a screen capture of my blog post writing the code for the screen capture script after I executed the screen capture once – I feel dizzy…