Download here: http://tr.im/D4BS
Description: The script takes text entered into QS text entry mode as a yubnub search. To read more about yubnub go here: http://tr.im/D4Ak. or to yubnub.org. Yubnub uses short prefix's to send your search to different search engines. "g poodles" will google search for poodles. "wp poodles" to wikipidea. And so on. There's thousands. Yubnub aspires to be a command line for the web. While yubnub is generally quite fast, this action bypasses yubnub and sends your text directly google for searches with the "g" prefix, for google image searches (prefix "gim"), wikipedia searches ("wp"), and amazon ("az"). This speeds it up that much more. qsearch action is intended as a potential replacement for the websearch plugin, which can be a bit funky in Snow Leopard. From my experience, it's faster. If you just want a google search and nothing else, it would take about 3 minutes to alter the script to do this. Installation: ~/Library/Application Support/Quicksilver/Actions Usage: Enter Quicksilver's text entry mode either via a trigger or by activating QS and typing a period. Enter your yubnub search and tab over, type till you the qsearch action is highlighted and hit enter. It should open the search in your system's default browser. For quick access you could go to QS Prefs >> Actions >> Text and drag qsearch up in priority. If its set to highest priority, then you can enter QS text entry mode (set up a trigger for that), type your search and hit enter without having to tab over. Code: (* qSearch is a Quicksilver action to send text entered in text entry mode to Yubnub as search. ElasticThreads, 10/18/2009 *) using terms from application "Quicksilver" on process text qtxt set dothis to my mainprogram(qtxt) return "" end process text end using terms from on mainprogram(intxt) set theSrch to klWS(intxt) set theURL to my chkengine(theSrch) tell application "System Events" open location theURL end tell return theURL end mainprogram on parsprefix(nsrch) set AppleScript's text item delimiters to " " set ct to count of text items of nsrch set prfx to 1st text item of nsrch set AppleScript's text item delimiters to "" if ct > 1 then set sufx to characters ((count of prfx) + 1) thru (count of nsrch) of nsrch as string set sufx to klWS(sufx) else set sufx to "" end if set prfx to klWS(prfx) if sufx is -1 then set sufx to "" end if return {prfx, sufx} end parsprefix on chkengine(insearch) set {prfix, sfix} to my parsprefix(insearch) if prfix is "g" then set sfix to my wsencode(sfix, "%20") set theURL to "http://www.google.com/search?hl=en&source=hp&q=" & sfix as string else if prfix is "gim" then set sfix to my wsencode(sfix, "%20") set theURL to "http://images.google.com/images?q=" & sfix as string else if prfix is "wp" then set sfix to my wsencode(sfix, "%20") set theURL to "http://en.wikipedia.org/?search=" & sfix as string else if prfix is "az" then set sfix to my wsencode(sfix, "%20") set theURL to "http://www.amazon.com/exec/obidos/external-search? mode=blended&keyword=" & sfix as string else set sfix to my wsencode(sfix, "+") set srchstr to prfix & " " & sfix as string set theURL to "http://www.yubnub.org/parser/parse?command=" & srchstr as string end if return theURL end chkengine on wsencode(insfix, cdchar) set AppleScript's text item delimiters to " " set templist to every text item of insfix set AppleScript's text item delimiters to cdchar set outsfix to every item of templist as string set AppleScript's text item delimiters to "" return outsfix end wsencode on klWS(intxt) -- will return txt without leading or trailing whitespace OR (if blank) -1 set outxt to "" set outid to 0 set k to 1 repeat set thschr to character k of intxt if thschr is " " then set outid to 0 else if thschr is "" then set outid to 0 else set outid to k exit repeat end if if k < (count of intxt) then set k to k + 1 else set k to -1 exit repeat end if end repeat if k > 0 then set midtxt to characters k thru (count of intxt) of intxt as string else return -1 end if set j to count of midtxt repeat set thschr to character j of midtxt if thschr is " " then set outid to 0 else if thschr is "" then set outid to 0 else set outid to j exit repeat end if if j > 1 then set j to j - 1 else set j to -1 exit repeat end if end repeat if j > 0 then set outxt to characters 1 thru j of midtxt as string else return -1 end if return (outxt as string) end klWS
