Title: Re: AppleScripted Quit Irregardless?
On 5/2/04 1:26 PM, "Norman W. Ferguson" <[EMAIL PROTECTED]> wrote:

> Hey all y'all Entourage/AppleScript gurus...
>
> I'd like to create an Finder-level AppleScript that (among other things)
> quits Entourage irregardless {as my mother the editor cringes} of it's
> connection state.
>
> I know that at times when issuing a quit command from within Entourage I
> sometime get that error message to the effect of "Ya sure? We got an active
> network connection at the moment, ya know."
>
> I've looked at the Entourage AppleScript dictionary, and I see the standard
> "quit saving yes/no//ask" command, but I'm not sure that applies to this
> situation.
>
> So is there an appropriate way to quit Entourage and say "yeah, I really
> really want to quit - now!"?

Did you try it?

    tell application "Microsoft Entourage" to quit saving no

still brings up the 'active connection' dialog if there is a connection. Did
you know that? (It seems an odd question to ask if you didn't, and odder not
to say so if you did.)

As yaw recall, there are UNIX 'kill' commands which do the same thing as a
Force Quit without a dialog, which you can do in AppleScript via a 'do shell
script'. The thing is to use 'kill' you need to know the PID (process
identification) number of the Entourage process. Since you're not in a
Terminal window that means first getting the list of all PIDs with their
(application) names as well and doing some sort of grep to find the line
with "Microsoft Entourage" and the PID from that.


Here's what I come up with:

set entLine to paragraph 1 of (do shell script "ps -auxwww | grep 'Microsoft Entourage'")
set entPID to word 2 of entLine
do shell script "kill " & entPID


As far as I can see, the real Entourage process is always the first line of the result, with the shell script itself the second line. As long as that's true, this should always work. (Tested.) Just perhaps you might have a user name which contains an AppleScript 'word separator', although I don't think that's possible. If so, you'd need 'word 3'.

--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

PLEASE always state which version of Entourage you are using - 2001 or X. It's often impossible to answer your questions otherwise.


--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.

Reply via email to