This is my first applescript in a long time, and I am having the worst time trying to get a simple text file to load into my script. I found many examples on the net but they neither work or do what I want. I want the file name and path hardcoded into the script (not chosen with dialog box). For testing purposes I been trying display the contents of the file in a text box of the interface. I am sure this is extremely simple but I cannot find any working example of this.
This is what I got so far that just returns an error
“nsreceiverevaluationscripterror: 4(1)”
on clicked theObject
set theFile to (read alias "homedirectory:server.txt")
set theFile to open for access ("server.txt" as POSIX file)
set theData to theFile as string
close access theFile
set contents of text view "log" of scroll view "log" of window of theObject to theData
end clicked
Thanks