# using jpeg files and text files to change itunes artwork and track inf

I have a very simple question but it is very confusing to me.
I am trying to add artwork from a jpeg file on my desktop or other path into a file in itunes.
all the scripts I see are based on current selection. What is the advantage to this?
I just want to put one jpeg on a track that is automatically placed into itunes each week.

``````tell application "iTunes"
set trackthing to current track
set theArt to (data of artwork 1 of trackthing) as picture

set tempartwork to ("Macintosh HD:Users:username:Desktop" & "ttbookpic1.jpg") as string
set file_reference to (open for access tempartwork write permission 1)
write theArt starting at 0 to file_reference as JPEG picture
close access file_reference
end tell
``````

I get this error when I run this.

and then a Huge Hex file.
can the same be done with a text file to change the track name?

also it appears most of the scripts also refer to track 1 of playlist 1 or similar numbering system.
This seems great for running loops but impractical for trying to change one file.