Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

boomtopper

macrumors member
Original poster
Mar 25, 2004
96
0
UK Huddersfield
Hi everyone,
I am currently learing applescript and have a fairly basic problem that i can't work out. Heres the code:-

Code:
tell application "Finder"
	set chosenDir to text returned of (display dialog "Open this directory" default answer "/usr/bin/")
	open folder (POSIX file chosenDir)
end tell

What this should do is display a dialog box and ask for a directory. For this i have set it up to open "/usr/bin/". The next part should open the directory but it does not. This part of the code is where the problem is and i can't figure it out.
Cheers, Richard
 
its all cool now i sat down and tried to work it out and have managed to. Here is the results!

Code:
tell application "Finder"
	set chosenDir to text returned of (display dialog "Open this directory" default answer "/usr/bin/")
	open folder (chosenDir as POSIX file)
end tell

as you can see the problem originally was becuase i was trying to open a string. When what i needed to do is cast the string to a POSIX file and bobs your uncle.

cheers, Richard
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.