• 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: "running" command issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "running" command issues


  • Subject: Re: "running" command issues
  • From: Joe <email@hidden>
  • Date: Sat, 5 Jul 2008 11:14:20 -0700

Title: Re: "running" command issues
Loren Ryter wrote:
Can anyone explain what the utility of using Leopard's "running" command is?

I was under the impression that it is faster than get "every process" from
"system events", and thought the latter was meant to be deprecated.

Unfortunately there seem to be problems.  For example, try this:

set anapp to "nothing"
if application anapp is running then set isRunning to true

AppleScript will ask you to locate the application "nothing".

Obviously this is not desired behavior.  I'd try to use "using terms from"
but I'm studiously avoiding that due to the know bug with compiling that on
Leopard and running on Tiger.

Is there a work around?  How can you trap the situation where anapp is not
known?  Can it be referred to by an application bundle ID instead of a name,
and would this make a difference?

Perhaps using the ID property?

<from Leopard release notes> *look at the next to the last line

There is a corresponding id property, so you can get the necessary id to tell:
get id of application "TextEdit"

-- returns "com.apple.TextEdit"

-- Now we know that 'tell application id "com.apple.TextEdit"' will work.

This does not require that the application be running.
When running a script, if an application specified by id is not found, AppleScript will not ask where it is. It will throw an error, which can be caught using a
try block.
Scripts intended for distribution should use the id form. That way, the script will continue to work even if the user has changed the name of the application.

HTH
Joe
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: "running" issues
      • From: Loren Ryter <email@hidden>
References: 
 >"running" command issues (From: Loren Ryter <email@hidden>)

  • Prev by Date: "running" command issues
  • Next by Date: Re: "running" issues
  • Previous by thread: "running" command issues
  • Next by thread: Re: "running" issues
  • Index(es):
    • Date
    • Thread