I'm trying to open an existing text file, add some HTML code, and write the result to replace a pre-existing second file, but I keep getting an end-of-file error right off the bat:
tell application "TextWrangler"
activate
set sourceFile to (choose file with prompt "Choose the ... text file:")
set targetFile to (choose file with prompt "Choose the ... HTML file:")
set introText to "<!DOCTYPE html PUBLIC ...(lots of header code)"
--read the books list
set booksList to read sourceFile as Unicode text using delimiter return
close access sourceFile
... <loop to do the deed, etc.>
end tell --"TextWrangler"
I'm trying to open an existing text file, add some HTML code, and write the result to replace a pre-existing second file. I've tried it with the surrounding "tell" set to TextEdit,
TextWrangler, Finder, and nothing. Regardless, I get this: