获取 iTunes 曲目 Applescript 的位置
我有下面的代码来转换 iTunes 中的曲目,但是当它尝试获取转换后的曲目的位置时,会出现错误:
tell application "iTunes"
set theFiles to the selection
repeat with theTrack in theFiles
with timeout of 120 seconds
set finish of theTrack to 30
set theSecondTrack to first item of {convert theTrack}
set theSecondPath to location of theSecondTrack
say "RingtoneDude has converted the song."
错误:
错误“无法获取库播放列表的{文件轨道 ID 3942”的位置 应用程序\“iTunes\”}的源ID 65的ID 2208。”编号-1728来自 «class pLoc» of {«class cFlT» id 3942 of «class cLiP» id 2208 of «类 cSrc» id 65}
I have the code below to convert a track in iTunes but when it is trying to get the location of the converted track it errors:
tell application "iTunes"
set theFiles to the selection
repeat with theTrack in theFiles
with timeout of 120 seconds
set finish of theTrack to 30
set theSecondTrack to first item of {convert theTrack}
set theSecondPath to location of theSecondTrack
say "RingtoneDude has converted the song."
Error:
error "Can’t get location of {file track id 3942 of library playlist
id 2208 of source id 65 of application \"iTunes\"}." number -1728 from
«class pLoc» of {«class cFlT» id 3942 of «class cLiP» id 2208 of
«class cSrc» id 65}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,您误解了
location
的作用。在 Finder 中显示 iTunes 曲目实际上要复杂一些,但幸运的是 Doug Adams 已经完成了,如您绝对应该查看 dougscripts.com 的其余部分,因为他已经创建了一个名为“make Ringable”的脚本(我认为这是您的目标),并在 GNU GPL 下发布了它 这里
=== 编辑:
哎呀,对不起,看起来
位置
确实工作,只是不是我的方式预期,请在选择一个文件的情况下尝试以下操作:Unfortunately you´ve misunderstood what
location
does. Revealing iTunes tracks in Finder is actually quite a bit more complicated but luckily has already been done by Doug Adams, as explained in this article.You should definitely check out the rest of dougscripts.com as he has already created a script (for what I assume is your goal) called "make ringable" and released it under GNU GPL here
=== EDIT:
Oops, I´m sorry, looks like
location
does work, just not how I expected, try the following with one file selected: