views:

211

answers:

1

I want an Applescript that refreshes a certain song in iTunes from a file. To address the file in iTunes, i have only the path to the file.

I tried it on my own with "refresh" and "file track" but I'm a total newbie on AppleScript so I didn't got anything to work.

+1  A: 

I'm an Applescript noob as well, but I figured out on my own! It's good to know that you can open the iTunes dictionary and browse for things. Applescript is a strange language, but a lot of it can be guessed from normal English.

Problems with my solution:

  • I can't figure out what the location alias is about, so I'm not sure what to enter here.
  • For some reason it does work with selection, but not with library playlist.

My code:

tell application "iTunes"
 set the_location to location of current track
 repeat with this_track in selection
  if (get location of this_track) is the_location then
   refresh this_track
   log "match"
  end if
 end repeat
end tell
Pepijn
Found these 2 options... Might want to try that :::tell application "iTunes" to get POSIX path of (get location of current track):::get every file track of playlist "Library"`
Pepijn