• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
are finder items items? what is a vector?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

are finder items items? what is a vector?


  • Subject: are finder items items? what is a vector?
  • From: Brennan <email@hidden>
  • Date: Wed, 23 Dec 2009 22:44:23 +0100

It's been a while since I did any applescripting. I am a bit rusty, and running Leopard fwiw.

I'm trying to write a script which will invert the Finder selection.

I know this can be easily done using the mouse in icon view, but I almost always use list view, and besides I need a automatic version.

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.

My script so far:

tell application "Finder"

 set inverted to {}

 set fitems to items of window 1

 repeat with i in fitems

  if i is not in selection then
   set end of inverted to i
  end if

 end repeat

 set selection to {}
 select inverted

end tell

I am getting stuck on the 'if' line - being told things like

Can’t make «class cfol» "Address Book Plug-Ins" of «class cfol» "Library" of «class sdsk» of application "Finder" into type vector.

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.

...and I am also confused about the fact that Finder defines an item class which is apparently distinct from the item property of a list. Is this a dereferencing issue?

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.

This should be so simple. Instead it is unfathomably opaque. Grr!

_______________________________________________
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
  • Follow-Ups:
    • Re: are finder items items? what is a vector?
      • From: Axel Luttgens <email@hidden>
    • Re: are finder items items? what is a vector?
      • From: "email@hidden" <email@hidden>
    • Re: are finder items items? what is a vector?
      • From: Brian Christmas <email@hidden>
    • Re: are finder items items? what is a vector?
      • From: Jon Pugh <email@hidden>
  • Prev by Date: Re: wait for Quicktime X export
  • Next by Date: Re: are finder items items? what is a vector?
  • Previous by thread: Re: wait for Quicktime X export
  • Next by thread: Re: are finder items items? what is a vector?
  • Index(es):
    • Date
    • Thread