Re: Entourage close main window
Re: Entourage close main window
- Subject: Re: Entourage close main window
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 15 Mar 2002 19:34:15 -0800
On 3/15/02 6:53 PM, "JollyRoger" <email@hidden> wrote:
>
Can someone tell me why this does not work?
>
>
-- begin script
>
-- you need Microsoft Entourage installed to run this script
>
property pCallerName : ""
>
>
try
>
tell application "Finder" to set foundApp to application file id "OPIM"
>
tell application "Finder" to set pCallerName to name of (foundApp)
>
end try
>
>
tell application pCallerName
>
activate
>
close +class mnWn;
>
end tell
>
-- end script
>
>
I get this error:
>
>
Microsoft Entourage got an error: main window doesn't understand the close
>
message.
>
Try this for the second part:
tell application pCallerName
activate
close <<property mnWn>>
end tell
Even though it compiles as <<class mnWn>>, there's evidently some difference
"under the skin", because it works, whereas typing <<class mnWn>> doesn't.
Maybe Jon Pugh knows how this works.
BTW, since you're being so careful to use raw code in case people change the
name of the app,or have more than one version, you should be aware that the
first part of your script won't protect your user from the wrong version
from trying to open if they have more than one with the same name. In
particular - the only real-life instance would normally be if they have both
Entourage 2001 and X. The file system in OS XS easily gets confused and will
open the most recently used version (e.g. 2001 on Classic), even if it's not
the one you want. You might do better to make the first part of the script:
try
tell application "Finder" to set foundApp to application file id "OPIM"
to set pCallerName to foundApp as alias as string -- whole path name
end try
(Of course the first line might still find the "wrong" one. There are
routines you can use to specify the "right" version.)
--
Paul Berkowitz
_______________________________________________
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.