Multiple searches in one template?

Sharing and discussing custom search templates for LaunchBar
Post Reply
blafusel
Posts: 6
Joined: Thu Apr 17, 2008 5:55 am
Contact:

Multiple searches in one template?

Post by blafusel » Thu Apr 17, 2008 5:57 am

Is it possible to create search template groups? (Like Saft allows in Safari?).

For example I like to search for the price of a DVD on Amazon and eBay. I would setup a Template called 'dvd' which would trigger opening the two links to each site with my given search.

Maybe a combination of using a template and a linux script?

blafusel
Posts: 6
Joined: Thu Apr 17, 2008 5:55 am
Contact:

One solution via AppleScript

Post by blafusel » Thu Apr 17, 2008 6:05 pm

Code: Select all

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



now i can trigger the script via LaunchBar, enter my search items and the script will open a new Safari window and one extra tab with the search results from Google and Yahoo.

not very elegant, but i'm a user not a scripter 8)

Post Reply