• 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
file references
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

file references


  • Subject: file references
  • From: Jim Brandt <email@hidden>
  • Date: Thu, 15 Nov 2012 12:13:33 -0600

What good is a file reference?

Example:
set filename to "Macintosh HD:Users:jimbrandt:•Partitions:HD2:Script Source:Libraries:DateLib.scpt"
set x to a reference to file filename
log x
tell application "Finder" to set n to name of x

results in a log showing:

(*file Macintosh HD:Users:jimbrandt:•Partitions:HD2:Script Source:Libraries:DateLib.scpt*)
tell application "AppleScript Editor"
get name of file "Macintosh HD:Users:jimbrandt:•Partitions:HD2:Script Source:Libraries:DateLib.scpt"
--> error number -1728 from file "Macintosh HD:Users:jimbrandt:•Partitions:HD2:Script Source:Libraries:DateLib.scpt"


The reason I'm asking this question is because the Finder returns a list of aliases whereas System Events returns a list of file references.

tell application "Finder" to set theList to (every item of folder sourceFolder)

vrs

tell application "System Events" to set theList to (every disk item of folder sourceFolder)

For a "large" directory (220 files and folders), several folders deep, the Finder took 25 seconds to return this list while System Events only took < 1 second.
If I then have to jump through hoops to use that reference though, I'll probably try a different way. (I'm leaning towards a Unix "ls" command).


TIA,

Jim Brandt
 _______________________________________________
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: file references
      • From: Paul Berkowitz <email@hidden>
    • Re: file references
      • From: Luther Fuller <email@hidden>
    • Re: file references
      • From: "koenig.yvan" <email@hidden>
  • Prev by Date: Re: Display list
  • Next by Date: Re: file references
  • Previous by thread: Re: Display list
  • Next by thread: Re: file references
  • Index(es):
    • Date
    • Thread