file references
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