On Friday, December 13, 2013 4:05:23 PM UTC+1, Tim Visher wrote:
> (Web Search) ⇥ Search For… ⇥ (search text) ↩ No context switch with
> the results in a new background tab.
>
Let me know if this applescript action works for you.
You could name it 'Search For… in Background', use the default action icon
and rank it higher than 'Search For…'.
Caveats:
1. You cannot use it to search multiple sites, since URLs selected with the
comma trick are passed as an empty string (bug)
2. You cannot use it with multiple search terms selected with the comma
trick — not even with 'Search For…' (bug?)
3. It doesn't change the third pane to text mode, although I
set NSStringPboardType (bug?).
*using terms from* *application* "Quıcĸsıɩⅴεʀ"
*on* *process text* theWebSearches with theSearchTerms
*tell* *application* "Safari"
*if* *not* (*exists* *some* *window*) *then* *make* new *document*
*tell* *first* *window*
*repeat* *with* theWebSearch *in* theWebSearches *as* *list*
*set* theSearchTerms *to* *my* urlEncode(theSearchTerms)
*set* theWebSearch *to* *my* findReplace("***", theSearchTerms, theWebSearch
)
*make* new *tab* with properties {URL:theWebSearch}
*end* *repeat*
*end* *tell*
*end* *tell*
*end* *process text*
*on* *get direct types*
*return* {"Apple URL pasteboard type"}
*end* *get direct types*
*on* *get indirect types*
*return* {"NSStringPboardType"}
*end* *get indirect types*
*on* *get argument count*
*return* 2
*end* *get argument count*
*end* *using terms from*
*on* urlEncode(theSearchTerms)
*return* *do shell script* "php -r 'echo urlencode(\"" & theSearchTerms &
"\");'"
*end* urlEncode
*on* findReplace(findText, replaceText, sourceText)
*set* ASTID *to* AppleScript's text item delimiters
*set* AppleScript's text item delimiters *to* findText
*set* sourceText *to* *text items* *of* sourceText
*set* AppleScript's text item delimiters *to* replaceText
*set* sourceText *to* sourceText *as* *text*
*set* AppleScript's text item delimiters *to* ASTID
*return* sourceText
*end* findReplace
--
You received this message because you are subscribed to the Google Groups
"Quicksilver" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/blacktree-quicksilver.
For more options, visit https://groups.google.com/groups/opt_out.