Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

iTunes "?" error

Hi, I've been working on an AppleScript that sets the comments of specific songs to the artist name and album name in both Finder and iTunes. This uses a text delimiter, which I'll need for another script, that separates the artist and album names into two separates items.


It all works fine except Finder keeps changing the question marks from the titles of song files and folders into underscores. For example, the songs in the album "Are You Experienced?" automatically get dropped into a new folder called "Are You Experienced_" . I have worked on this for two days straight and I am absolutely stumped. Does anybody know how to keep the question marks in those titles? I'll try any suggestions you have!


Don't forget to highlight the songs in iTunes before running the script!



property seperator : "/"
tell application "iTunes"
     set curSongs to every track of playlist "Library"
     set thisSong to curSongs
     set theCount to 0 --flag duplicates with a comment
     repeat with thisSong in selection
          set theCount to theCount + 1
          get theCount
          if theCount = 1 then
               set lastSong to thisSong
          else
               set fileloc to location of thisSong as alias
               set details to artist of thisSong & seperator & album of thisSong
               set comment of thisSong to details
               set details to my list_to_text(details, return) as Unicode text
               tell me to fill_comments(fileloc, details)
          end if
     end repeat
end tell
set AppleScript's text item delimiters to {""}
beep

----------------------------------
to fill_comments(fileloc, details)
     tell application "Finder"
          try
               set comment of fileloc to details
          end try
     end tell
end fill_comments
on list_to_text(details, return)
     set AppleScript's text item delimiters to "/"
     set txt to text items of details
     return (txt)
end list_to_text

MacBook, Mac OS X (10.6.8)

Posted on Mar 11, 2012 10:32 AM

Reply
Question marked as Best reply

Posted on Mar 11, 2012 11:59 AM

It is not the Finder, but rather iTunes that does not use the question mark in the file name. This most likely is because there is a version of iTunes for Windows, where a question mark is not legal to use in a file name.


Maybe your other other script has a problem with the file name, but I'm not sure what your question is here - the song names and other metadata still use the question mark (the comments all have question marks in them).

2 replies
Question marked as Best reply

Mar 11, 2012 11:59 AM in response to greenyouse

It is not the Finder, but rather iTunes that does not use the question mark in the file name. This most likely is because there is a version of iTunes for Windows, where a question mark is not legal to use in a file name.


Maybe your other other script has a problem with the file name, but I'm not sure what your question is here - the song names and other metadata still use the question mark (the comments all have question marks in them).

Mar 11, 2012 2:47 PM in response to red_menace

You're completely right! I assumed that something in my script accidently caused to Finder to change the "?" symbol but that symbol really is always displayed as the "_" symbol for iTunes items. I wanted to figure out what caused the problem but I guess I didn't know that that is how the "?" symbol always shows up that way.


My issue is also with my other script too not this one so you were right there too. Thanks for the advice!

iTunes "?" error

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.