8 replies
Sign in or join Beachball Help to reply.
- 0
V.K. ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
tell application "Finder"
open (path to documents folder)
end tell</pre> - 0
Kappy ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
You should start with The AppleScript Language Guide.
- 0
Ronan ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I tried this:
tell application "Finder"
(open) / Users / macbook / documents
end tellWhen I compile, Applescript adds the commas to open and puts spaces around the slashes.
I get this error: Finder got an error: Handler can’t handle objects of this class.
- 0
V.K. ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
read the applescript guide that kappy linked. this is
NOT how you specify paths in applescript. you can do it as I did in my example. there are other ways too. you can do this
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
tell application "Finder"
open ("/Users/macbook/Documents" as POSIX file)
end tell</pre> - 0
Ronan ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi, Thanks..
I tried
tell application "Finder"
open ("/Users/macbook/Documents" as POSIX file)
end telland got this:
Finder got an error: AppleEvent handler failed.
any ideas?
- 0
baltwo ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Post to the AppleScript forum under OS X Technologies.
- 0
V.K. ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Ronan wrote:
Hi, Thanks..I tried
tell application "Finder"
open ("/Users/macbook/Documents" as POSIX file)
end telland got this:
Finder got an error: AppleEvent handler failed.
this means that you are using wrong username. i assumed from your previous post that macbook was your username. what you should put there instead of macbook is your short user name which is the same as the name of your home directory.
any ideas?
- 0
Barney-15E ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
In the first example, V.K. didn't mean for you to fill in "path to documents folder" but to actually copy that exact script.
path to documents folderis a valid Applescript statement. You can get a 'path to' various default folders using that command and the correct form of the special folder name.
In Applescript, paths are delimited with the colon ( : ). So, the path to user macbook's documents folder that is stored on the hard drive named "Macintosh HD" is "Macintosh HD:Users:macbook:Documents"
In the second example, V.K. used the POSIX path method which allows use of unix-style paths.