Re: Finder scripting bug
Re: Finder scripting bug
- Subject: Re: Finder scripting bug
- From: "Nigel Garvey" <email@hidden>
- Date: Tue, 17 Jan 2006 01:26:15 +0000
Matt Deatherage wrote on Mon, 16 Jan 2006 13:26:08 -0600:
>And I think it is a bug, though
>every time I look at what you wrote, I keep thinking, "Wait, there's
>some catch, this might be working correctly..."
>
>> set OKNames to {"2.jpg", "03.jpg"}
>> tell application "Finder"
>> every file of myFolder whose name is in OKNames
>> end tell
>>
>> Files in the folder with names like "2.jpg", "02.jpg", "002.jpg",
>> "3.jpg", "03.jpg", "003.jpg", etc are _all_ returned by the above
>> reference in Tiger.
[snip]
>I just tried it, and it works as long as the filename extensions match.
> It's like Finder is comparing for integer equality or something, as
>any number of leading zeroes matches. ("3E0" does not match "3.0" in a
>filename, though that would have been fun, too.)
It seems this particular filter doesn't differentiate between names that
begin with numbers and names that are identical to them except for
leading zeros.
>Can't think of a workaround, either, dangit.
A repeat that uses the listed names explicitly, I suppose. In the script
that brought this to light, it was simple. OKNames is derived from a list
of all the file names in the folder, so the matching files are known to
exist. I just had to replace the original line...
tell application "Finder" to duplicate (every file of thisFolder whose
name is in OKNames) to holdingFolder
... with this:
tell application "Finder"
repeat with thisName in OKNames
duplicate file thisName of thisFolder to holdingFolder
end repeat
end tell
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden