Applescript: Help to extract PDF "Author" metadata and set it in iTunes Author field Using other applescript as template, I've been trying to modify this particular one to do the following task:

Extract "Author" tag from a PDF file and write it automatically in the iTunes12 "Author" tag and for as many PDF files I select in my Books collection in iTunes (yes! I got rid of iBooks and got back Books in iTunes)

After grooming for years all my books in the iTunes library, I moved to iBooks. I didn't like iBooks so I went back to Books in iTunes. But this comeback, although worthy, it's been painful, because I lost all the iTunes tags I filled for years manually, but few at the time.

I would love to have this script done to alleviate the pain of writing the +4,000 author's book tags, which are sitting inside the properties of each of my PDFs.

My tweaked script can't get the Author tag from the PDF file and place it in iTunes. It just place the character I want to set at the end of the author in case I want to add info to the tag in the future.
This is, that the only thing that appears in the iTune tag is the "-".

I'm not a expert. I'm not even a basic coder. I just try to learn, little by little about coding when I have these challenges. I've been banging my head to get this done, but this time I need help. I looked everywhere for a similar case from which I could translate the concept to no avail. 

Could anyone of you please tell me what can I do to get this done. Where to look for info, what to change in the code or even say: "that's impossible"!

Thank you very much in advance!

-- PDF Meta Author to iTunes Author | script (iTunes-Acrobat)

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_alias to location of the_track as alias

    tell application "Adobe Acrobat Pro"

        open the_alias

        set authorfield to Author of document 1 as list

        set Author to item 1 of author field

        close document 1 saving no

    end tell

    set artist of the_track to (authorfield &amp; "-") as string

    end repeat

    end tell
This uses the built in unix commands to get the Author.

Try it and let me know if it needs a tweak.

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 " &amp; quoted form of the_posix_path &amp; "|  awk -F\\\" '{print $2'}")

        set artist of the_track to (authorfield &amp; "-") as string
    end repeat


end tell