Copy and Paste Between Objects

This version prompts for the source file and creates a new file on your desktop named Music_Export.txt that contains the original source except the track title has been changed as specified in the posts above.

set theXMLfile to (choose file) as string
set theXML to paragraphs of (read file theXMLfile)

repeat with i from 1 to count theXML
	if item i of theXML contains "<track_title>" then
		set tt to item i of theXML
		set tt_o to offset of ">" in tt
		set tht to item (i + 2) of theXML
		set tht_ws to offset of "<" in tht
		set tht_o to offset of ">" in tht
		set tht_string to text (tht_o + 1) through -(tht_o - tht_ws + 3) of tht
		set new_tt to (text 1 through tt_o of tt) & tht_string & ". " & (text (tt_o + 1) through -1 of tt)
		set item i of theXML to new_tt
	end if
end repeat

set newXML to theXML as string

set deskPath to (path to desktop) as Unicode text
set filePath to deskPath & "Music_Export.txt"

try
	close access file filePath
end try

set fileRef to (open for access file filePath with write permission)
set eof fileRef to 0
write newXML to fileRef
close access fileRef

James and Stephan,

This is amazing…you both have been so very helpful. So, far, your example works the best James…there are some things im going to change with it, but the script works very well. Thank you both for all of your time, work, and patience!

Brian :smiley: X 2

Anytime Brian, I’m glad I could be of help =)