AppleScript to set video kind of current track to music video

Discussion in 'Mac Programming' started by mduser63, Dec 31, 2005.

  1. macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #1
    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.

    Code:
    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.
     
  2. thread starter macrumors 68040

    mduser63

    Joined:
    Nov 9, 2004
    Location:
    Salt Lake City, UT
    #2
    For the benefit of anyone who finds this later, I got an answer 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.
     

Share This Page