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

--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to