• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [Q] How to get a containing folder of a given file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] How to get a containing folder of a given file?


  • Subject: Re: [Q] How to get a containing folder of a given file?
  • From: Yvan KOENIG <email@hidden>
  • Date: Wed, 20 Sep 2006 09:32:00 +0200


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


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >[Q] How to get a containing folder of a given file? (From: JongAm Park <email@hidden>)

  • Prev by Date: Re: [Q] How to get a containing folder of a given file?
  • Next by Date: Re: Screen Shots
  • Previous by thread: Re: [Q] How to get a containing folder of a given file?
  • Next by thread: Re: [Q] How to get a containing folder of a given file?
  • Index(es):
    • Date
    • Thread