MaxB
MaxB

Reputation: 127

AppleScript: File that exists not found

My applescript is telling me that the file I'm trying to get is not found. But it's right here, I can open it using the exact same path in the terminal. Here is a simplified version of the code that gives the same error:

set theFile to "~/Desktop/MyFile.csv" as alias
set theContent to read theFile as «class utf8»

Upvotes: 1

Views: 1174

Answers (1)

ThrowBackDewd
ThrowBackDewd

Reputation: 1767

Your path string is incorrect for applescript. It's expecting an HFS path like this... Path:to:my:file:MyFile.csv, not a POSIX path.

I would recommend doing something like this...

set theFile to ((path to desktop folder as string) & "MyFile.csv") as alias

Upvotes: 2

Related Questions