From the Adobe scripting reference for Applescript, for Illustrator (I believe is same for other products too), I see code example snippets like:
on openFile(fileToOpen)
tell application "Adobe Illustrator"
activate
open POSIX file fileToOpen as alias with options
end tell
end openFile
Why does it leave us to figure out the (string) value of fileToOpen? Understandable that that is Applescript specific, but that is more work for those of us not familiar with Applescript to do more research.
Is "as alias" really needed? I'm having trouble with this. Omitting "as alias" gets Applescript error: "Adobe Illustrator got an error: AppleEvent handler failed." Keeping "as alias" results error saying it can't create alias to the path, which for some reason looks like it's formatted as Applescript path even though specified as POSIX (e.g. ":~:Documents:Temp:someFile.ai" instead of "~/Documents/Temp/someFile.ai").
Tried the straightforward example
open POSIX file "~/Documents/Temp/someFile.ai"
as well as
set pfile to "~/Documents/Temp/someFile.ai" as POSIX file
open pfile without options
set pfilepath to "~/Documents/Temp/someFile.ai"
set pfile to POSIX file pfilepath
open pfile as alias without options
nothing seems to work so far. Such a pain.