I get the error message: “Can’t get application folder” when trying to check the syntax. I don’t know if this means anything, but I don’t have admin privileges to the Applications folder (there’s another folder buried in there that I’m ultimately going for). Other examples from the FAQ page work fine.
A few more notes, fwiw. The error message I quoted in my original post only happens when I put my original line of code within a Finder tell block. If it’s on its own, then the syntax checks out, but I get an error when running that says “can’t get folder.” Checking the syntax also removes the ‘s’ if I type ‘applications’. Wierd.
There have often been terminolgy conflicts in the past between ‘path to’ and the Finder. That’s why many scripters try to avoid using ‘path to’ inside a tell block.
One of 'path to’s little-advertised tricks is its ability to return the path to an application:
path to application "System Events"
--> alias "PowerBook HD:System:Library:CoreServices:System Events.app"
I imagine that when the compiler finds an expression like ‘path to application folder’, the ‘application folder’ phrase is treated as an application specifier. Inside a Finder tell block, ‘folder’ is a Finder keyword and so doesn’t make sense after the keyword ‘application’. This causes the compiler to signal an error. When the line’s not in a tell block, I suppose the compiler just takes ‘folder’ on faith as a variable that will make sense at run time. In fact, it doesn’t make sense then either so the error’s caught by the run-time engine.
The above’s just guesswork, but I think it must be pretty close to the truth.