I have a script that the last time I ran was in 10.5, and now it isn’t working right so I go into Script Debugger and I’m getting an error just trying to compile the script that hasn’t changed.
The offending line is:
set f to open for access file fileSpec with write permission
The error is:
AppleScript Syntax Error
Expected end of line, etc. but found identifier.
The variable “fileSpec” is what Script Debugger leaves highlighted after it gives me the error so it made me think that I had to redo that line for 10.6.
Microsoft Entourage was calling this script and when the script hung up in Script Debugger Entourage itself also seemed to hang up. So I had to force-quit Entourage, and once that was done then Script Debugger compiled the script happily.
So the error isn’t as much a compilation error as it is a run-time error. Ok, interesting! So I’m guessing that file paths in 10.6 are the change that I’m running up against.
This runs perfectly for me in Snow Leopard; what’s different in your script (must be the address)? For a file that doesn’t yet exist, for example, the address cannot be specified as an alias.
set tFile to ((path to desktop folder as text) & "someFile.txt")
set F to open for access file tFile with write permission
close access F