using terms from application "Colloquy" on process user command theCommand with theArguments for theView if theCommand is "gone" or "away" then tell theView to send message "is away: " & theArguments to theView with action tense do shell script "defaults write com.Colloquy.awayscript 'awaym' '" & theArguments & "'" do shell script "defaults write com.Colloquy.awayscript 'awayt' '" & (current date) & "'" end if if theCommand is "back" then if (do shell script "defaults read com.Colloquy.awayscript 'awayt'") is "" then add event message "You were not away" end if if (do shell script "defaults read com.Colloquy.awayscript 'awayt'") is not "" then set timestamp to (current date) - date (do shell script "defaults read com.Colloquy.awayscript 'awaym'") set gonetime to "Gone " & timestamp div hours & " hours, " & timestamp div minutes & " minutes, " & timestamp - (timestamp div minutes * 60) & " seconds." tell theView to send message "is back: " & gonetime with action tense do shell script "defaults write com.Colloquy.awayscript 'awaym' ''" end if end if end process user command end using terms from