Re: Using tell application "name" where the name comes from GUI Script...
Re: Using tell application "name" where the name comes from GUI Script...
- Subject: Re: Using tell application "name" where the name comes from GUI Script...
- From: "Kevin Bohan" <email@hidden>
- Date: Thu, 17 Apr 2003 10:54:02 +0000
This seems to work. Thanks. Just a couple of points:
1. I changed the script from process to application process as per Bill
Cheeseman's response to my mail.
2. Some applications may present a dialog when told to quit, so I put an
"ignoring application responses" statement.
3. Some apps seem to cause some grief for my script I sometimes get a popup
saying that there was an invalid connection. I don't know what this is, so I
put a try block around it.
4. I have two process with similar creator type. They only differ by string
case. One is the Dock which has a creator type of 'dock', and the other is
DragThing which has a creator type of 'Dock'. The code you gave me doesn't
distinguish between these two codes. So, I put a "considering case" block
around it. However, this still doesn't work.
Any idea how I can get this to distinguish creator codes based on case?
Here's my new code:
tell application "System Events"
considering case
set pp to name of application processes whose creator type is not "CSOm"
and ,
creator type is not "ToyS" and ,
creator type is not "VIZF" and ,
creator type is not "dplt" and ,
creator type is not "lgnw" and ,
creator type is not "syui" and ,
creator type is not "MACS" and ,
creator type is not "dock" and ,
creator type is not "sevs"
end considering
end tell
repeat with p in pp
try
ignoring application responses
tell application p to quit
end ignoring
end try
end repeat
If all you want to do is quit the applications, then no special terminology
is involved. With the exception of a few 10++ year old applications, every
app will respond to the required
--
name of processes whose creator type is not in {"CSOm", "ToyS"}
--
So you have to write it like this. Never put a 'quit' event within a
Finder and (I guess) a System Events tell block.
tell app "System Events"
set pp to name of processes whose creator type is not "CSOm" and +AKw
creator type is not "ToyS" and +AKw
creator type is not "VIZF" and +AKw
creator type is not "dplt" and +AKw
visible is true
end
repeat with p in pp
tell app p to quit
end
--JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_________________________________________________________________
Stay in touch with absent friends - get MSN Messenger
http://www.msn.co.uk/messenger
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.