我有一个applescript,我要求一首歌来设置播放计数,另一个来设置最后播放的日期。这些从perl脚本中调用,从last.fm中获取数据。不幸的是,每当我打电话给最后播放的日期脚本时,我收到一条错误消息setItunesLastPlayed.scpt: execution error: iTunes got an error: A descriptor type mismatch occurred. (-10001)
。Applescript,iTunes和'date'
我打电话这样说:
osascript /Users/gms8994/setItunesLastPlayed.scpt "<ARTIST>" "<TITLE>" "Wednesday, July 05, 2011 07:14:11 AM"
我也注意到,如果我要求的从iTunes最终玩价值,它回来没有零填充日期和时间,所以我试图消除那些,无济于事。
这是我的脚本。
on run argv
tell application "iTunes"
set theArtist to (item 1 of argv)
set theTitle to (item 2 of argv)
set theLastPlay to (item 3 of argv)
set theLastPlay to date theLastPlay
set results to (every file track of playlist "Library" whose artist contains theArtist and name contains theTitle)
repeat with t in results
tell t
say theLastPlay
set played date of t to theLastPlay
end tell
end repeat
end tell
end run
任何人都可以指出我的修复?
该错误是非常通用的。你的游戏计数脚本是否有效?您是否曾尝试从脚本编辑器或脚本调试器运行Applescript,并确切地查看它失败的位置? –
@Philip Regan play count脚本工作正确,因为它只是传入一个数字。当我在编辑器中运行日期脚本时,使用硬编码的“字符串”(“set theLastPlay to date”,2011年7月5日星期三上午07:14:11“')它正常工作。 –
我在这里阅读这篇文章之前发布了一条评论,但是我想知道当字符串从perl传递到Applescript时是否会进行某种转换,导致字符串在创建日期对象时不再可解析。 –