Applescript iTunes曲目播放日期

Applescript iTunes曲目播放日期,applescript,Applescript,以下AppleScript按预期工作,为指定的用户播放列表中的第一首曲目提供上次播放的值 tell application "iTunes" set theTrack to (item 1 of tracks of user playlist "Named") set playedDate to played date of theTrack display dialog (playedDate as string) end tell 但是,此AppleScript不会

以下AppleScript按预期工作,为指定的
用户播放列表中的第一首曲目提供上次播放的

tell application "iTunes"
    set theTrack to (item 1 of tracks of user playlist "Named")
    set playedDate to played date of theTrack
    display dialog (playedDate as string)
end tell
但是,此AppleScript不会编译,而是给我一个错误
预期的行尾等,但找到了类名。

tell application "iTunes"
    my testMethod(item 1 of tracks of user playlist "Named")
end tell

on testMethod(theTrack)
    set trackName to (name of theTrack)
    display dialog trackName
    -- set playedDate to played date of theTrack
    -- display dialog playedDate        
end testMethod

这两个脚本是否如此不同,以至于AppleScript的编译器出现问题?在第二个示例中,如何将曲目的
播放日期
输入到
播放日期

播放日期
iTunes
应用程序术语的一部分,您需要一个应用程序
tell

tell application "iTunes"
    set playedDate to played date of theTrack
end tell
或者使用应用程序中的术语来帮助编译器解析术语的

using terms from application "iTunes"
    set playedDate to played date of theTrack
end using terms from
您现在可能会问:
name
为什么起作用?在许多应用程序中,
name
是一个众所周知的属性,甚至连AppleScript运行程序都知道它