Le 20 sept. 2006 à 07:05, JongAm Park a écrit : Hello. I am trying to get the path of a containing folder of a file. By looking up the dictionary and some web sites, I found out that there was a "containder" property of a file. However this presents an error message.
tell application "Finder" set my_file_path to path to desktop folder -- get container of my_file_path as text set directory_path to (container of my_file_path) end tell
Hello
What is the problem you met ?
When I run your script:
tell application "Finder" set my_file_path to path to desktop folder set directory_path to (container of my_file_path) end tell
I get this report:
tell application "Finder" path to desktop alias "Macintosh HD:Users:yvankoenig:Desktop:" get container of alias "Macintosh HD:Users:yvankoenig:Desktop:" folder "yvankoenig" of folder "Users" of startup disk end tell
It shows that the script works flawlessly.
I assumes that in fact you are trying to use the result in a command which doesn't accept the given class of the result.
As is, directory_path's class is folder. It's YOUR responsability to coerce it to the needed class, string or alias.
Yvan KOENIG
|