PDA

View Full Version : AppleScript to set video kind of current track to music video




mduser63
Dec 31, 2005, 03:16 PM
I'm trying to write a script that will set the video kind of the current track in iTunes to music video. I think it has to be done with GUI scripting. I'm fairly new to AppleScript, and very inexperienced with GUI scripting, and I'm having trouble. So far I've got the script below.


tell application "iTunes"
activate
set currTrackName to the name of the current track
end tell
tell application "System Events" to keystroke "i" using command down
tell application "System Events"
tell process "iTunes"
try
tell tab group 1 of window currTrackName
click radio button "Options"
delay 1
click menu item "Music Video" of menu 1 of pop up button 1 of group 1
end tell
end try
end tell
end tell


It opens the Get Info window and clicks the "Options" tab, but for some reason the pane where the options should be never fills in. If you take focus away from iTunes, it will fill in the pane, but what appears is the default view (ie last selected view) in the Get Info box. It's a little hard to explain, but it should be clear if you run it yourself. Can anyone figure out what I'm doing wrong or how to get around the problem I'm encountering?
Alternatively, has anyone already written a script that will set the video kind of video tracks to music video (preferably multiple tracks at once)?

In case it matters, I'm running 10.4.3 and iTunes 6.0.1.



mduser63
Jan 1, 2006, 01:55 AM
For the benefit of anyone who finds this later, I got an answer (http://discussions.apple.com/message.jspa?messageID=1433028) to an identical post on Apple Discussions. Still not sure why my script doesn't work, but the script provided in that thread does work.