Why not post this on the Quicksilver wiki?
http://qsapp.com/wiki/AppleScripts

On Tuesday, January 28, 2014 1:36:15 PM UTC-5, 1.61803 wrote:
>
> This applescript action checks for Tor Browser's process, if it's not 
> running launches it and waits until the first window opens after a 
> connection has been established. Otherwise it quits Tor Browser and 
> notifies you using QS's default handler. Next it opens a URL or 
> comma-separated text URLs. You can customize how long it waits for the 
> connection.
>
>
> using terms from application "Quıcĸsıɩⅴεʀ"
>   
>   on process text theURLs
>     
>     TorConnection(10, 0.5)
>     
>     set theURLs to theURLsToCSV(theURLs)
>     
>     repeat with theURL in theURLs as list
>       if theURL does not start with "http" then set theURL to "http://"; & 
> theURL
>       do shell script "open -b org.mozilla.torbrowser " & theURL
>       delay 0.1
>     end repeat
>     
>   end process text
>   
>   on get direct types
>     return {"NSStringPboardType", "Apple URL pasteboard type"}
>   end get direct types
>   
> end using terms from
>
> on TorConnection(Attempts, HoldTime)
>   tell application "System Events"
>     if not ((every process whose bundle identifier is 
> "org.mozilla.torbrowser") exists) then
>       tell application id "org.mozilla.torbrowser" to launch
>       tell application "Quıcĸsıɩⅴεʀ" to show notification "Tor Browser" 
> image name "org.mozilla.torbrowser" text "Trying to connect" & return & "to 
> TOR network…"
>       repeat with i from 1 to Attempts
>         delay HoldTime
>         if (count of (windows whose visible is true and name is not "Tor 
> Status") of application "TorBrowser") > 0 then
>           exit repeat
>         else if i is Attempts then
>           tell me to do shell script "killall firefox"
>           tell application "Quıcĸsıɩⅴεʀ" to show notification "Tor 
> Browser" image name "org.mozilla.torbrowser" text "Connection failed" & 
> return & return & "Quitting…"
>           error number -128 -- User canceled
>         end if
>       end repeat
>     end if
>   end tell
> end TorConnection
>
> on theURLsToCSV(theURLs)
>   -- for multiple values use comma-separated text, comma trick doesn't 
> work with text nor URLs, #1727
>   if theURLs contains "," then
>     set {ASTID, AppleScript's text item delimiters} to {AppleScript's text 
> item delimiters, {","}}
>     set theURLs to text items of theURLs
>     set AppleScript's text item delimiters to ASTID
>   end if
>   return theURLs
> end theURLsToCSV
>

-- 
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.

Reply via email to