I’m new at working with Applescript, and I’m not a programmer, so please bear with me, as I’m sure this has a simple solution that is just eluding me. I need to have a little script to quit iChat even though it has one or more chat windows open. The problem is that quitting with a chat open brings up a window saying that there are active chats, asking whether I am sure I want to quit (“No”, “Yes”). The “Yes” button pulses blue as the default. So I need to get past that window.
If I’ve manually quit iChat, at that point running the script:
tell application "System Events" tell process "iChat" click button "Yes" of window 1 end tell end tell
works fine; iChat quits fully as intended.
But if I get iChat to quit by first scripting it to do so:
quit application "iChat" tell application "System Events" tell process "iChat" click button "Yes" of window 1 end tell end tell
it doesn’t work. The script simply stops dead after sending the command for iChat to quit. Adding an “activate iChat” line after the “quit” line doesn’t help.
What am I missing?
Instead of doing it this way, I’d be fine if there was a way to script iChat to first close all active chats in one fell swoop, and then quit. But I can’t figure out how to do that. Like I said, I’m really new at this…
Any help would be greatly appreciated.