Re: are finder items items? what is a vector?
Re: are finder items items? what is a vector?
- Subject: Re: are finder items items? what is a vector?
- From: "email@hidden" <email@hidden>
- Date: Wed, 23 Dec 2009 15:05:02 -0800
> Brennan>>Now I am running up against typically infuriating AppleScript errors featuring unmapped terminology for perfectly ordinary classes like «class cfol» and a strange datatype - a 'vector' mentioned in the error message.
cfol is the raw code for folder. That it's displaying is (I think) part of the same bug that's confusing lists with vectors. That bug, btw, I don't believe is causing the problem, but is a bug in the error codes which makes it more difficult to solve the problem. I also wouldn't consider this a typical AppleScript error.
> Can’t make «class cfol» "Address Book Plug-Ins" of «class cfol» "Library" of «class sdsk» of application "Finder" into type vector.
What I think is happening is that you're asking Finder to compare apples and orange. So below is a version of your script, that works. No guarantee that it works as well as Jon's or any other solution, but it may help see where the your version was erroring.
> I tried coercing i to 'item' because I have experienced in the past that 'repeat with in' gives me references rather than what I really want. But it didn't work.
Alias list and/or alias seems more reliable than item.
> Also, why does it want a vector? What is a vector? Isn't that a Java datatype - something like an array?
>
> I saw Michelle had a very similar problem with Mail back in Februrary, but it was not resolved afaict. Philip Aker responded with
>
> "Seems like a bug to me (vector ≠ list)." which doesn't help me at all.
I can report that I get the same error in SN.
Here's the script
-------------------
tell application "Finder"
set inverted to {}
set fitems to items of window 1 as alias list
set selectedItems to the selection as alias list
repeat with i in fitems
if i is not in selectedItems then
set end of inverted to i
end if
end repeat
select inverted
end tell
-------------------
HTH
ES
Hoping to make it to MacWorld, just to hear Sal's presentation.
_______________________________________________
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