I tinkered together this script to make a smart playlist for every TV Show in my library.
tell application "iTunes"
activate
set showList to {}
set trackCount to count of every track of library playlist 1
set processedCount to 1
repeat while processedCount ≤ trackCount
set theShow to show of track processedCount of library playlist 1 as string
set add2List to true
if showList contains theShow then set add2List to false
if add2List is true then
set showList to showList & (theShow as string)
if not (exists (some user playlist whose name is theShow)) then
tell application "iTunes"
activate
tell application "System Events" to tell process "iTunes"
keystroke "n" using {option down, command down}
tell scroll area 1 of group 1 of window 1
click pop up button 2
click menu item "Show" of menu 1 of pop up button 2
delay 0.5
click pop up button 1
click menu item "is" of menu 1 of pop up button 1
keystroke theShow & return
end tell
end tell
end tell
end if
end if
set processedCount to processedCount + 1
end repeat
end tell
The problem is that this works great on Leopard, but on Tiger, it hangs on the click pop up button 2 line and throws an NSReceiverEvaluationScriptError: 4
Any ideas ?
Model: Intel iMac
AppleScript: 2.0.1
Browser: Safari 531.22.7
Operating System: Mac OS X (10.5)