I’ve been able to write to files with Standard Additions before without problems, but now I am having one that I can’t figure out. I have a file that is pretty much in HTML format(although saved as .txt), and then I want to prepend some more HTML to the beginning, and have it as an HTML file. This is what the script(which isn’t complete, but gives the general idea) looks like:
set doc to destHTMLFiles & fileName & ".txt"
set myDoc to (open for access doc with write permission)
set speech to read myDoc
set temp to "<HTML>" & return & "<HEAD>" & return & "<TITLE>" & fileName & "</TITLE>" & return & "</HEAD>" & return & "<BODY>" & return & "<H2 align="center"><i>" & speechTitle of speechInfo & "</i></H2>"
set HTMLDoc to destHTMLFiles & fileName & ".html"
set myHTMLDoc to (open for access HTMLDoc with write permission)
write temp & speech to myHTMLDoc
close access doc
close access HTMLDoc
However, I keep getting the error “File not open with write permission.”
Am I missing something here? Any help will be appreciated. Thank you