Re: Getting running status of an application
Re: Getting running status of an application
- Subject: Re: Getting running status of an application
- From: "Bob.Kalbaugh" <email@hidden>
- Date: Fri, 31 Aug 2001 21:48:18 -0500
on 8/30/01 7:39 PM, Ric Phillips at email@hidden wrote:
>
>>
>
>> Then check the result window which will display a list with the name of the
>
>> running processes. Your application should be in the list. You can then use
>
>> its name in the following manner,
>
>>
>
>> tell application "finder"
>
>> if process "<name of process>" exists then
>
>> quit "<name of app>"
>
>> end if
>
>> end tell
----
On 8/31/01 at 12:20 AM, Bob.Kalbaugh <email@hidden> wrote:
>
> Can you please expand upon this, for no matter what application I try...
>
>
>
> the Finder Quits! ouch!
>
>
>
> Luckily I was able to get it back with a tell Finder to activate from Script
>
> Editor
>
>
>
> example of my try:
>
>
>
> tell application "Finder"
>
> if process "Tex-Edit Plus" exists then
>
> quit "Tex-Edit Plus"
>
> end if
>
> end tell
>
>
>
> Am I missing something here? (and yes, I'm using the exact name)
>
>
>
> thanks much.
>
>
>
> Bob "Hell, I'll try anything" Kalbaugh
----
on 8/31/01 4:33 AM, J.B. Stewart at email@hidden wrote:
>
or better yet
>
Tell application "Finder" to set procList to name of every process
>
if "NameOfProcess" is in procList then tell application "<name of app>" to
>
quit
----
on 8/31/01 6:04 AM, Nigel Garvey at email@hidden
wrote:
>
Don't mention the word 'quit' inside a Finder 'tell' block or the Finder
>
may take it personally. :-)
So I see.
>
>
tell application "Finder"
>
set procExists to process "<name of process>" exists
>
end tell
>
if procExists then tell application "<name of process>" to quit
>
>
NG
----
on 8/31/01 8:57 AM, Mr Tea at email@hidden wrote:
>
I think you need to replace the line 'quit "Tex-Edit Plus"' with 'tell
>
application "Tex-Edit Plus" to quit'.
>
>
That should fix it.
>
>
Mr Tea
Thanks to J.B., Nigel and Mr. Tea for sharing your insight. And to
Christopher Stone and Tim Wilkinson for replying off-list. All of you folks
have pretty much said the same thing.
I think it's fair to point out that *my* try was based on the example
provided by Ric Phillips. I was just testing *his* script. I had noticed
that the quit command was within a *Finder* tell block, but I tried it
anyway since Ric's script suggested it. My thinking at the time was hey,
maybe Finder can quit an application? I didn't know and I certainly didn't
know that the Finder itself would quit. Now I do. :-)
Actually, I was hoping to recieve a response from Ric. To see if it was just
a mistake in his example. But you guys cleared it up, and I appreciate it.
Maybe as I gain more knowledge of AppleScript, I will instinctively know to
avoid this type of thing. There's much to be learned from trial and error.
BTW - I'll be posing a question shortly in a new post that pertains to the
solutions provided here. If any of you can help with it, I would really
appreciate it.
Thanks again,
--
Bob - Expanding his AS knowledge by learning what NOT to do - Kalbaugh