Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: are finder items items? what is a vector?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: are finder items items? what is a vector?

> 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



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:

This email sent to email@hidden

 >are finder items items? what is a vector? (From: Brennan <email@hidden>)

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.