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

Re: extracting info from list returned by info for


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

Sorry, I forgot to mention that this script is for a Mac Book Pro running Tiger (10.4.11). My Script Editor reports it is Version 2.1.2 (82.1), AppleScript 1.10.7 in case it makes a difference.

Mari

Begin forwarded message:

From: Mari Masuda
Date: October 2, 2009 16:09:13 PDT
To: email@hidden
Subject: extracting info from list returned by info for

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
References: 
 >extracting info from list returned by info for (From: Mari Masuda <email@hidden>)

  • Prev by Date: extracting info from list returned by info for
  • Next by Date: Re: extracting info from list returned by info for
  • Previous by thread: extracting info from list returned by info for
  • Next by thread: Re: extracting info from list returned by info for
  • Index(es):
    • Date
    • Thread