mu3
mu3

Reputation: 749

Applescript for iTunes: Set video kind doesn't work

If I uncomment the "video kind" line then not all the files will be added to the library and part of the added files will not be processed (including shufflable and bookmarkable flags).

on adding folder items to my_folder after receiving the_files
    repeat with i in the_files
        tell application "iTunes"
            set newAddition to add i
            tell newAddition
                (* set video kind to music video *)
                set shufflable to true
                set bookmarkable to false
            end tell
        end tell
    end repeat
end adding folder items to

Upvotes: 1

Views: 375

Answers (1)

osxgeek
osxgeek

Reputation: 26

Maybe "set video kind" does not work with every type of media (track).

Anyway, it's good to error-proof all iTunes code, so whenever you change something in iTunes add a "try/error" routine so you can react how you want.

This shows you a nice error dialog:

 try
      set video kind to music video
 on error the error_message number the error_number
      display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
 end try

Try it once this way and when it fails you get an error number and message.

Hope that helps.

BTW: You can select and paste such snippets with a CTRL-Click within "Apple-Script Editor".

Upvotes: 1

Related Questions