Scriptonite
New member
- Joined
- Apr 2, 2015
- Messages
- 12
- Points
- 0
Hi there,
I have been building an applescript for iTunes to extract the author name from PDF tags and place it in the "Author" tag of my books (pdf) sitting in iTunes (I put back Books in iTunes and got rid of iBooks).
Actually, I have done little since my knowledge in applescripts is very incipient.
What I've been doing is modifying an existing script and modifying here and there and adding code that other friends around internet have gave me.
The script is almost complete, but has a problem: either reading or writing or both, the information, if the name in the tags of the PDF has especial characters (i.e. á, é, ñ, ü.....) it will write the iTunes tag with alphanumeric sequences where this special characters are: "Odtü Kutuphanési" the printed name in iTunes is: "Odtu\U0308 Kutuphane\U0301si
Could you please provide with the additional code to fix this problem?
Thank you very much in advance!
This is my code so far:
I have been building an applescript for iTunes to extract the author name from PDF tags and place it in the "Author" tag of my books (pdf) sitting in iTunes (I put back Books in iTunes and got rid of iBooks).
Actually, I have done little since my knowledge in applescripts is very incipient.
What I've been doing is modifying an existing script and modifying here and there and adding code that other friends around internet have gave me.
The script is almost complete, but has a problem: either reading or writing or both, the information, if the name in the tags of the PDF has especial characters (i.e. á, é, ñ, ü.....) it will write the iTunes tag with alphanumeric sequences where this special characters are: "Odtü Kutuphanési" the printed name in iTunes is: "Odtu\U0308 Kutuphane\U0301si
Could you please provide with the additional code to fix this problem?
Thank you very much in advance!
This is my code so far:
Code:
tell application "iTunes"
set sel to the selection
if sel is {} then display dialog "Please select something" buttons {"Cancel"}
repeat with i from 1 to count of sel
set the_track to item i of sel
set the_posix_path to POSIX path of (location of the_track as alias)
set authorfield to paragraph 2 of (do shell script "mdls -name kMDItemAuthors " & quoted form of the_posix_path & "| awk -F\\\" '{print $2'}")
set artist of the_track to (authorfield & "-") as string
end repeat
end tell