• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Checking if an application is opened or not
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking if an application is opened or not


  • Subject: Re: Checking if an application is opened or not
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 26 Feb 2003 16:36:36 -0800

Why do people insist on doing it that way? This also works, is more efficient, and I've always considered it clearer:

tell application "Finder" to get exists process "aProcess"
if the result is true then ...

If you don't mind having the whole thing enclosed in a tell block, you can even make it grammatically correct:

tell application "Finder"
if process "aProcess" exists then ...
end tell

For what it's worth, the original problem -- that if you tell an application that's not running to quit, it'll launch it and then send it a quit event -- is considered a bug and will be fixed in a future release.


--Chris Nebel
AppleScript Engineering

On Wednesday, February 26, 2003, at 03:44 PM, Jeffrey Mattox wrote:

Okay people, stand back! I'll handle this one. I asked the exact same thing a few weeks ago. And for the same reason.

Do this:

tell application "Finder" to name of processes
if ("aProcess" is in the result) then
display dialog "aProcess" running"
else
display dialog "aProcess" not running"
end if

At 3:17 PM -0800 2/26/03, Guillaume Iacino wrote:

Sorry if this question has been asked before, but I am looking for the
proper way to detect if an application is already opened or not.

I have a script that unmounts all my external hard drives and closes some
apps too. My problems is that if the apps are not opened, my script opens
them and then quit them.....
tell application "Finder" to eject (every disk whose local volume is false)
tell application "Notes" to quit
_______________________________________________
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.

References: 
 >Re: Checking if an application is opened or not (From: Jeffrey Mattox <email@hidden>)

  • Prev by Date: Controlling volume in OSX
  • Next by Date: General Questions
  • Previous by thread: Re: Checking if an application is opened or not
  • Next by thread: Trouble with Unicode text
  • Index(es):
    • Date
    • Thread