获取 iTunes 曲目 Applescript 的位置

发布于 2024-10-19 14:41:08 字数 675 浏览 1 评论 0原文

我有下面的代码来转换 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟酒忠诚 2024-10-26 14:41:08

不幸的是,您误解了 location 的作用。在 Finder 中显示 iTunes 曲目实际上要复杂一些,但幸运的是 Doug Adams 已经完成了,如

您绝对应该查看 dougscripts.com 的其余部分,因为他已经创建了一个名为“make Ringable”的脚本(我认为这是您的目标),并在 GNU GPL 下发布了它 这里

=== 编辑:

哎呀,对不起,看起来位置确实工作,只是不是我的方式预期,请在选择一个文件的情况下尝试以下操作:

tell application "iTunes"

tell item 1 of the selection to set theLocation to {get location}
tell application "Finder" to reveal theLocation

end tell

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:

tell application "iTunes"

tell item 1 of the selection to set theLocation to {get location}
tell application "Finder" to reveal theLocation

end tell
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文