Re: Finder scripting: OS 9 vs OS X
Re: Finder scripting: OS 9 vs OS X
- Subject: Re: Finder scripting: OS 9 vs OS X
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 15 Aug 2002 09:46:25 -0700
On 8/15/02 8:46 AM, "Fox, Christopher B" <email@hidden>
wrote:
>
Why does the following script work fine in Mac OS 9.2.2 (AS 1.8.3), but fail
>
in Mac OS X 10.1.5?
>
>
tell application "Finder"
>
set theFiles to every file of (choose folder)
>
repeat with aFile in theFiles
>
set fileInfo to info for aFile
>
end repeat
>
end tell
>
>
Mac OS X 10.1.5 complains, "Finder got an error: File document file <file
>
name> wasn't found."
If you look in Standard Additions, you'll see that the argument for 'info
for' is "anything -- the alias or file reference to the file or folder".
But you're using the Finder's 'file' reference, which is a different kettle
of fish. And in OS X, it seems to be confused - it considers almost every
file to be this 'document file' thing. In OS 9, the Finder file probably
coerced naturally to the AppleScript 'alias' format needed by 'info for'. or
else maybe you have Jon's Commands or Akua Sweets installed, which will do
it for you. In OS X you should spell it out, outside the Finder:
tell application "Finder"
set theFiles to every file of (choose folder)
end tell
repeat with aFile in theFiles
set fileInfo to info for (aFile as alias)
end repeat
Actually, it works fine inside the Finder tell lock too, if you really need
it to (why?):
tell application "Finder"
set theFiles to every file of (choose folder)
repeat with aFile in theFiles
set fileInfo to info for (aFile as alias)
end repeat
end tell
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.