• 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
NSAppleScript: Compiling a script launches an application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAppleScript: Compiling a script launches an application


  • Subject: NSAppleScript: Compiling a script launches an application
  • From: Alexander von Below <email@hidden>
  • Date: Fri, 29 Jul 2005 15:01:43 +0200

Hello List,

I am usually a Cocoa coder, and have noted something that seems odd to me: If the following file is compiled by an NSAppleScript object (either explictly or upon first execution), iTunes is launched:


tell application "System Events"
    if exists process "iTunes" then
        tell application "iTunes"
            if player state is playing then
                set x to name of current track & "    " & artist of current track
                return x
            else
                return "No"
            end if
        end tell
    else
        return "No"
    end if
end tell

All subsequent executions of the script work as expected (i.e. not launching iTunes if it is not running)

If the script is modified like this:

tell application "System Events"
    if exists process "iTunes" then
        return "Yes"
    else
        return "No"
    end if
end tell

Everything works as expected again.

If someone likes to try, you can download a sample application at http://software.vonbelow.com/ASTest.zip

Thanks a lot for your help!

Alex


P.S.: If Apple people are reading this, I have filed this in the bugreporter as issue 4197892

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSAppleScript: Compiling a script launches an application
      • From: Christopher Nebel <email@hidden>
    • Re: NSAppleScript: Compiling a script launches an application
      • From: Simon Forster <email@hidden>
  • Prev by Date: [OT] "Message" when file created.
  • Next by Date: Re: [OT] "Message" when file created.
  • Previous by thread: Re: [OT] "Message" when file created.
  • Next by thread: Re: NSAppleScript: Compiling a script launches an application
  • Index(es):
    • Date
    • Thread