-- Script to fetch destinations: -- spits something out of form: -- -- Send to Clipboard -- Open in Browser -- Paste to Adium: -- Allan Odgaard -- Paste to Colloquy: -- allan -- ##textmate -- Paste to iChat: -- Jacob Rus -- Send to Quicksilver -- on run getDestinations() end run on getDestinations() local sepA, sepB, openApps, destList, adiumChats, colloquyChannels, ichatAccounts set sepA to " " set sepB to " " tell application "System Events" set openApps to name of application processes end tell set destList to {} set destList to destList & {"Send to Clipboard"} set destList to destList & {"Open in Browser"} -- get open chats from Adium, if it is open if openApps contains "Adium" then tell application "Adium" if version < "1.2" then set adiumChats to (��class AchN�� of every ��class Acht��) else set adiumChats to (display name of first contact of every chat) -- get display name of every contact where status type is not offline -- theory set adiumOnlineContacts to {} repeat with i from 1 to number of items in contacts -- in practice due to adiums FUBAR library set this_contact to item i of contacts set conStatus to "" try get join of (properties of this_contact & {""}) by "," on error errmsg set conStatus to rich text ((offset of "type:" in errmsg) + 5) thru ((offset of "type:" in errmsg) + 11) of errmsg end try if conStatus is not "offline" then set adiumOnlineContacts to (adiumOnlineContacts & {get display name of this_contact}) end if end repeat end if end tell if adiumChats is not {} then -- set adiumChats to join of ({"Open chats:"} & adiumChats) by (sepB & " ") -- use this if paste dialog supports 3 levels set adiumChats to join of ({"Paste to Open Adium Chats:"} & adiumChats) by sepB end if if adiumOnlineContacts is not {} then -- set adiumOnlineContacts to join of ({"Online contacts:"} & adiumOnlineContacts) by (sepB & " ") -- use this if paste dialog supports 3 levels -- set adiumChats to (adiumChats & ({sepB} & adiumOnlineContacts)) -- use this if paste dialog supports 3 levels set adiumOnlineContacts to join of ({"Paste to Online Adium contacts:"} & adiumOnlineContacts) by sepB if adiumChats is not {} then set adiumChats to ({sepA} & adiumChats) end if set adiumChats to (adiumOnlineContacts & adiumChats) end if if adiumChats is not {} then --set adiumChats to join of ({"Paste to Adium:"} & adiumChats) by sepB -- use this if paste dialog supports 3 levels set destList to destList & {adiumChats} end if end if -- get open IRC channels from Colloquy, if it is open if openApps contains "Colloquy" then tell application "Colloquy" to set colloquyChannels to ((name of direct chat panels where name is not "nickserv") & name of chat room panels) if colloquyChannels is not {} then set colloquyChannels to join of ({"Paste to Colloquy:"} & colloquyChannels) by sepB set destList to destList & {colloquyChannels} end if end if -- get all online accounts from iChat, if it is open if openApps contains "iChat" then tell application "iChat" to set ichatAccounts to name of buddies where status is not offline and status is not unknown if ichatAccounts is not {} then set ichatAccounts to join of ({"Paste to iChat:"} & ichatAccounts) by sepB set destList to destList & {ichatAccounts} end if end if if openApps contains "Quicksilver" then set destList to destList & {"Send to Quicksilver"} end if return join of destList by sepA end getDestinations to join of aList by sep local aString, delims set delims to AppleScript's text item delimiters set AppleScript's text item delimiters to sep set aString to aList as string set AppleScript's text item delimiters to delims return aString end join