property t_text : "" -- as AS is typed stronger than perl, grumble property t_fileLoc : "" property t_chan : "" on run tell application "ircle 3.1.2 OS X" set t_fileLoc to "Personal:Incoming:irc.hosts" -- figure out what channel we're supoosed to be dealing with -- IE use the current channel unless passed something -- beep & quit if channel is invalid in any way if not (exists (argument 1)) then try set t_chan to name of channel currentchannel as string on error msg number num if num is -1719 then -- no channels, or "Console" is in front beep return end if end try else if exists channel (argument 1) then set t_chan to argument 1 else -- no valid channel, mutter and grumble and quit beep return end if end if set t_text to "" -- form up variable with the hosts, one per line repeat with dausers in users of channel t_chan as list set t_text to t_text & (hostname of dausers as string) & return end repeat end tell set t_fileLoc to t_fileLoc & t_chan saveFileReplacing(t_text, t_fileLoc) end run -- summary: this routine saves theText to file thePath, replacing any previous contents -- theText: the text to save (string) -- thePath: the path to the file (string) -- returns: no error on saveFileReplacing(theText, thePath) try set theFileReference to open for access file thePath with write permission set eof theFileReference to 0 write theText to theFileReference close access theFileReference -- fix creator to BBEdit :) tell application "Finder" set creator type of file thePath to "R*ch" end tell on error errMsg number errNum try close access theFileReference end try error errMsg number errNum end try end saveFileReplacing