# Created by Nando Vieira # http://simplesideias.com.br # # Create a file at "~/Library/Application Support/Quicksilver/Actions/tiny.scpt" and # put the code below. on isRunning(appName) tell application "System Events" set isAppRunning to (name of processes) contains appName return isAppRunning end tell end isRunning on runningBrowserUrl() if isRunning("Firefox") then tell application "Firefox" set props to properties of front window as list set theUrl to item 3 of props end tell else if isRunning("Safari") then tell application "Safari" set theUrl to URL of front document end tell else if isRunning("Opera") then tell application "Opera" set props to GetWindowInfo of window 1 set theUrl to item 1 of props end tell else if isRunning("Camino") then tell application "Camino" set theUrl to URL of window 1 end tell else set theUrl to "" end if return theUrl end runningBrowserUrl on registerGrowl(appName, appIconOf) tell application "GrowlHelperApp" register as application appName all notifications {"Alert"} default notifications {"Alert"} icon of application appIconOf end tell end registerGrowl on notifyGrowl(appName, theTitle, theDescription) tell application "GrowlHelperApp" notify with name "Alert" title theTitle description theDescription application name appName end tell end notifyGrowl using terms from application "Quicksilver" on process text theUrl set appName to "Tiny URL" set appIconOf to "Quicksilver.app" registerGrowl(appName, appIconOf) if theUrl = "" then set theUrl to runningBrowserUrl() end if if theUrl = "" then notifyGrowl(appName, "Tiny URL failed!", "No running browser found") return end if set theUrl to do shell script "curl http://tinyurl.com/api-create.php?url=" & theUrl set the clipboard to theUrl as string notifyGrowl(appName, "Tiny URL done!", theUrl) end process text end using terms from