• 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: NSAppleScript error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAppleScript error


  • Subject: Re: NSAppleScript error
  • From: Marco Cassinerio <email@hidden>
  • Date: Sun, 6 Sep 2009 22:33:31 +0200


On Sep 6, 2009, at 22:25, has wrote:

Marco Cassinerio wrote:

I tried a lot of AS and the error is related to the AS request.
For example, this to get the current playing track in iTunes:

tell application "iTunes"
	set curr_path to get location of current track
	return POSIX path of curr_path
end tell

The error:

   NSAppleScriptErrorAppName = iTunes;
   NSAppleScriptErrorBriefMessage = "Can\U2019t get location of
current track.";
   NSAppleScriptErrorMessage = "iTunes got an error: Can\U2019t get
location of current track.";
   NSAppleScriptErrorNumber = -1728;


That suggests the iTunes player is currently stopped, in which case a 'current track' reference usually isn't available. If you need to, you can find out iTunes' current state by querying the application's 'player state' property. Or you can trap the -1728 error raised if that's easier using a 'try' block.

FWIW, it's always a good idea to double-check AppleScript-related problems in the [Apple]Script Editor before posting for help. If the issue is NSAppleScript itself, post here or to the applescript- implementors list for help. If it's a general AppleScript query, you will have most luck posting it to applescript-users as that's where most of the AppleScripting experts reside.

http://lists.apple.com/mailman/listinfo/applescript-implementors
http://lists.apple.com/mailman/listinfo/applescript-users

HTH

has

As i said in the first message, i checked the AS with AppleScript Editor and also by executing the script with an ad hoc command tool app that uses NSAppleScript. They both work!
iTunes was playing a track and the script works both on AppleScript Editor and command line app. It doesn't work in the Service. I haven't mentioned i'm writing a .service add-on and not a service provided by an application.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: NSAppleScript error (From: has <email@hidden>)

  • Prev by Date: Re: Symbolic Links in Snow Leopard
  • Next by Date: Re: completion handlers?
  • Previous by thread: Re: NSAppleScript error
  • Next by thread: Should we release a CGImage created from NSBitmapImageRep ?
  • Index(es):
    • Date
    • Thread