Results 1 to 2 of 2

Thread: AppleScript with iTunes

  1. #1
    Join Date
    May 2004
    Posts
    2

    Default AppleScript with iTunes

    Hello...

    I'm not sure if it's me, my computer, or iTunes specifically, but I've noticed that scripts seem to run really slow against iTunes. Even something as simple as:

    Code:
    tell application "iTunes"
            set poss to ((file tracks of playlist 1) whose database ID is 4177)
            if ((count of poss) is greater than 0) then
                    set myTrack to item 1 of poss
                    try
                            set Name of myTrack to "newName"
                            set Artist of myTrack to "newArtist"
                            set Album of myTrack to "newAlbum"
                            set Track Number of myTrack to "1"
                    end try
            else
                    display dialog "Error finding track ID 4177"
            end if
    end tell
    ...can take 60-90 seconds to run on a 1GHz G4. The entire time, my CPU is pegged, and a ktrace shows a lot of calls to sigprocmask.

    Is this typical, or am I missing something?

    The impetus behind this is that I had to write a script to restore a bunch of tags after a run of iEatBrainz went screwy.

    TIA,

    --Dj

  2. #2
    Join Date
    May 2004
    Posts
    2

    Default Turns out to be an error on the keyboard side...

    It was actually the line:

    set poss to ((file tracks of playlist 1) whose database ID is 4177)

    ...that was causing the problem.

    The following works a lot faster:
    Code:
    tell application "iTunes"
        set lib to the first playlist
        set myTrack to the first track of lib whose database ID is 4177
        try
            set Name of myTrack to "..."
            .
            .
        end try
    end tell
    Ah well...

    --Dj

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •