开发者

Limit ringtone length AppleScript

I have the AppleScri开发者_StackOverflow中文版pt code shown below which tells iTunes to convert the track from the selection. I was wondering how I would limit the length of the track that will be converted?

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)


If you wanted to to limit the length of the converted track via the iTunes GUI, you would set the "Stop Time" of the original track in Get Info>Options. The corresponding AppleScript property for this is finish (of the track class).

So the steps in your repeat loop should be:

  1. Get the original stop time of the track (usually this will just be the full duration of the track)
  2. Set the stop time to your limit length (in seconds)
  3. Convert the track
  4. Set the stop time back to what it was at 1.

Example 60-sec limit:

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜