Apple Script error: Can't get Folder
Posted
by
Jonathan Hirsch
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan Hirsch
Published on 2012-04-08T11:25:22Z
Indexed on
2012/04/08
11:29 UTC
Read the original article
Hit count: 432
I started using apple script today, because I wanted to be able to automatically send files to someone when they go into a specific folder. I first tried with automator, but the files were never attached into emails, so i figured i could try with apple script.
At first, I tried simply create an email with an attached file. The email was created, but the file was not attached. After a while, I stumbled onto this post that was trying to list files from a folder, so I tried that just to compare it to my code. It gave me an error telling me it is impossible to list files from that folder. So I tried setting a path to a specific folder, and I got an error saying the path can't be made. This is the code I used for the last part:
tell application "Finder"
set folderPath to folder "Macintosh HD: Users:Jonathan:Desktop:Send_Mail"
set fileList to name of every file in folderPath
end tell
and this is the error I got.
error "Finder got an error: Can’t get folder \"Macintosh HD: Users:Jonathan:Desktop:Send_Mail\"." number -1728 from folder "Macintosh HD: Users:Jonathan:Desktop:Send_Mail".
I later tried with another folder, and I always get this error, even when using the Users folder for example.
Any Suggestions? thanks
© Stack Overflow or respective owner