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 try if (do shell script "defaults read com.Colloquy.awayscript 'awaym'") is "" then add event message "You were not away" end if if (do shell script "defaults read com.Colloquy.awayscript 'awaym'") is not "" then set timestampr to (current date) - (date (do shell script "defaults read com.Colloquy.awayscript 'awayt'")) set ghours to (timestampr div hours) set gminutes to (timestampr - ((ghours * 60) * 60)) div minutes set gseconds to (timestampr - (timestampr div minutes * 60)) set gonetime to "Gone " & ghours & " hours, " & gminutes & " minutes, " & gseconds & " seconds." set gonetime to "Gone " & timestampr div hours & " hours, " & timestampr div minutes & " minutes, " & timestampr - (timestampr div minutes * 60) & " seconds." tell theView to send message "is back: " & gonetime with action tense do shell script "defaults write com.Colloquy.awayscript 'awaym' ''" do shell script "defaults write com.Colloquy.awayscript 'awayt' ''" end if on error (err) tell theView to add event message err end try end if end process user command end using terms from