• 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
extracting info from list returned by info for
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

extracting info from list returned by info for


  • Subject: extracting info from list returned by info for
  • From: Mari Masuda <email@hidden>
  • Date: Fri, 2 Oct 2009 16:09:13 -0700

Hi,

I am new to AppleScript. I am having trouble figuring out how I can extract the value of the "folder" field from a list returned by the "info for" command. When I do the following, it works and in the log I am able to get the name extension (e.g., "txt") of the file I chose:

---script snippet---
set myFile to (choose file)

tell application "Finder"
	set MARI to name extension of (info for myFile)
	log MARI
end tell
---end script snippet---

What I really want to do, however, is extract the value of the "folder" property in the list returned by "info for". When I try the following, I get an error:

---script snippet---
set myFile to (choose file)

tell application "Finder"
set MARI to folder of (info for myFile) -- MARI should be false in this example
log MARI
end tell
---end script snippet---


The list returned by "info for myFile" is:
{name:"example.txt", creation date:date "Friday, July 3, 2009 09:43:54", modification date:date "Friday, July 3, 2009 10:47:20", icon position:{0, 0}, size:4.4885E+4, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"txt", displayed name:"example.txt", default application:alias "Macintosh HD:Applications:TextEdit.app:", kind:"Plain text document", file type:"file creator:"type identifier:"public.plain-text", locked:false, busy status:false, short version:"", long version:""}


and the error I get when I try to get the value of the "folder" property in the list is:
An error has occurred (-1728). Can't get folder of {name:"example.txt", creation date:date "Friday, July 3, 2009 09:43:54", modification date:date "Friday, July 3, 2009 10:47:20", icon position:{0, 0}, size:4.4885E+4, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"txt", displayed name:"example.txt", default application:alias "Macintosh HD:Applications:TextEdit.app:", kind:"Plain text document", file type:"file creator:"type identifier:"public.plain-text", locked:false, busy status:false, short version:"", long version:""}.


Thanks for any help.

Mari
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: extracting info from list returned by info for
      • From: Israel Chauca Fuentes <email@hidden>
    • Re: extracting info from list returned by info for
      • From: Michelle Steiner <email@hidden>
    • Re: extracting info from list returned by info for
      • From: Mari Masuda <email@hidden>
  • Prev by Date: Re: Timed Out (Silence)
  • Next by Date: Re: extracting info from list returned by info for
  • Previous by thread: Re: Timed Out (Silence)
  • Next by thread: Re: extracting info from list returned by info for
  • Index(es):
    • Date
    • Thread