[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selection in Finder



Hi Andre,

Unfortunately, there is no easy or even reasonable way to get the current
selection in the Finder.  Several developers have figured out how to do it,
but they did it by hacking the internal Finder data structures and they
will probably have to rev their software when a new Finder comes out.

I only vaguely know how they did it.  The Finder is written in C++, and if
you look in the refCon of the windows in the Finder window list, you will
find a handle to a C++ object representing the window.  By looking at
various offsets into the C++ object and traversing various data structures,
some people have managed to figure out what the selection is.  But
obviously this approach is very fragile, and a new release of the Finder
could easily break them.

In the upcoming System 7.5 release, we will have a scriptable version of
the Finder, so you should be able to find the selection by sending the
Finder Apple events.  I'm not sure, but the scriptable Finder might
actually be available as part of the AppleScript 1.1 release (don't quote
me on that, I'm not sure if it has been released yet or not).

Hope this helps,

Mike Lockwood (former Finder engineer, now a Dylan hacker)

At  6:58 PM 4/28/94 -0400, Steve Strassmann wrote:
>Any tips for this MCL user?
>
> >Date: 20 Apr 94 12:30:27 U
> >From: "Andre Koehorst" <andre_koehorst@riks.nl>
> >Subject: Selection in Finder
> >To: info-mcl@cambridge.apple.com
> >
> >REGARDING                Selection in Finder
> >Hi,
> >
> >For a program I'm working on I need to know what disks, files and or
> >folders are currently selected in the Finder.
> >I've looked in the library folder and spent some time with a pile of IM
> >manuals, but that didn't help me very much. Anyone any ideas on how to get
>this
> >from the OS?
> >
> >Thanks in advance,
> >
> >Andre
> >
> >
> >