0

我有下面显示的 AppleScript 代码,它告诉 iTunes 从选择中转换曲目。我想知道如何限制将要转换的曲目的长度?

tell application "iTunes"
    set theFiles to the selection

    repeat with theTrack in theFiles
        with timeout of 120 seconds
            set theSecondTrack to first item of (convert theTrack)
4

1 回答 1

0

如果您想通过 iTunes GUI 限制转换曲目的长度,您可以在 Get Info>Options 中设置原始曲目的“停止时间”。对应的 AppleScript 属性是finishtrack类的)。

所以重复循环中的步骤应该是:

  1. 获取曲目的原始停止时间(通常这只是曲目的全部持续时间)
  2. 将停止时间设置为您的限制长度(以秒为单位)
  3. 转换轨道
  4. 将停止时间设置回原来的 1。

60 秒限制示例:

repeat with theTrack in theFiles
    tell theTrack
        set originalFin to finish
        set finish to 60

        -- Track conversion code goes here

        set finish to originalFin
    end tell
end repeat
于 2011-04-02T14:53:53.137 回答