Quit handler needed

I have an applescript on four separate computers that pops up an alert to each customer service rep whenever a visitor enters a room on our chat server. Once the customer service rep clicks “OK”, the script should kill the pop-ups on the other three computers. It appears to work really well except that it needs to be a stay-open app. That being the case, I need a Quit handler (or at least I think) that will quit the app when all of the other three pop-ups are closed. Here’s the current script (names changed to protect the innocent):

property lisIP : {“192.168.1.101”, “192.168.1.102”, “192.168.1.103”} --your ip list
property lisUsr : {“admin”, “admin”, “admin”} --your user names
property lisPass : {“password”, “password”, “password”} --your passwords

with timeout of 600 seconds
set the date_stamp to {"GUEST IN ROOM 1

" & (the current date) as string}
beep 4
say “Guest in Room 1”
display dialog the date_stamp buttons {“OK”} default button 1
–make sure your ip/user/password lists line up
repeat with x from 1 to count lisIP
set thisMachine to “eppc://” & (item x of lisUsr) & “:” & (item x of lisPass) & “@” & (item x of lisIP) as string
ignoring application responses
try
tell application “Finder” of machine thisMachine to open file “Applications:Applescript:chatscripts:killappaftercheck1”
end try
end ignoring
end repeat
end timeout

The “killappaftercheck1” is a shell script that kills the pop-up.

Where/How should the Quit handler be placed?

Thanks!

Pretty neat. This is a separate script that you’re calling from your stay-open listener app, right? So what is it that you’re killing that’s effecting the listener? Can you explain what’s happening a little further or post the code for the listener and killer?