All I can say is that the script seems to work OK on
my computer, except when the iTunes window isn't already open. So I first added a few lines to the beginning of the script to handle that situation. Most importantly for
you, I also added five 1 sec. delays, in order that you can check if the script works properly, though very slowly, with all of them present. If so, you could then try to remove them one by one, or choose shorter delays for some of them, until you find the best solution. I hope it can help.
tell application "iTunes" to activate
tell application "System Events" to tell process "iTunes"
set menuItem to menu item "iTunes" of menu 1 of menu bar item "Window" of menu bar 1
if value of attribute "AXMenuItemMarkChar" of menuItem is "" then
keystroke "1" using {option down, command down} -- open the iTunes window
delay 1 -- for testing
end if
keystroke "n" using {option down, command down} -- New Smart Playlist…
tell scroll area 1 of group 1 of window 1
delay 1 -- for testing
click pop up button 2
delay 1 -- for testing
click menu item "Composer" of menu 1 of pop up button 2
delay 1
click pop up button 1
delay 1 -- for testing
click menu item "is" of menu 1 of pop up button 1
delay 1 -- for testing
keystroke "Beethoven" & return
end tell
delay 1
keystroke "New smart playlist" & return -- to rename the playlist
end tell
My experience is that GUI scripting works well once adapted to the computer your are using.