dropping to the Finder

Richard Gaskin ambassador at fourthworld.com
Fri Feb 26 13:22:13 EST 2010


Jeff Massung wrote:

> On Fri, Feb 26, 2010 at 10:46 AM, Richard Gaskin wrote:
...
>> But as Jan suggested, how do most FTP clients work?  In Interarchy I can
>> drop to any folder and it works great.  I'd like to be able to do something
>> similar - there must be a way.
>
> Sorry, Richard, perhaps I'm misunderstanding, but most FTP clients aren't
> doing anything special that I'm aware of. Usually it's the target
> application's responsibility to know what to do with whatever is dropped on
> it.
>
> I was under the impression that you wanted to know where it was dropped and
> then begin to do some work (like combing all the files into a single zip)
> and then perform the transfer.
>
> As an example of what I'm thinking, if I browse to an image in FireFox, and
> then drag the image to my desktop, FireFox isn't doing anything here (that
> I'm aware of) other than creating a drag object containing data that points
> to the image's URL. Explorer (or the Finder on Mac) is then responsible for
> accepting the drag data of that type and handling it appropriately (in this
> case, starting either a download or creating an alias/shortcut to the
> hyperlink location).
>
> This is my very cursory understanding of this, though. I haven't worked with
> a lot of FTP clients, and the ones I have had 2 directory trees: local and
> report, and I dragged and dropped within the application.

I've used a few like that myself (GoLive and FileZilla work that way). 
It may be just a Mac convention that supports this so well, but I use 
Interarchy for FTP and it does a wonderful job of behaving Finder-like: 
  I just drag the file name from its listing into the Finder and it 
starts the download.  Beautiful, simple, lets the user interact with 
their files directly in the context they're most familiar with.


> On Win32 I know you can also hook into the messages sent to another
> window/process (not sure about OS X). It's possible some of the applications
> you have used in the past do this and when they receive a remote file drop
> event they end up sending a message back to the main application to initiate
> the transfer.

Exactly.  I'm not sure what the API looks like for Win and Linux, but I 
was able to turn up the Cocoa API and posted it to a new RQCC request to 
extend the dragDestination to include a list of file paths when dragging 
to the Finder, Windows Explorer, or Linux file manager:

<http://quality.runrev.com/qacenter/show_bug.cgi?id=8634>


In the meantime I thought of a crude hack:

If I had a shell call to get the paths of all open windows, I could 
cache the file listings from each into an array, do the drag, and after 
the drop check the file listings again, comparing them to the ones I've 
cached until I find the one in which the change is the name of the file 
I've dragged.

It's a lot of overhead, but provides so much usability that I'm willing 
to give it a try if only I could find the shell commands to get that 
list of open windows for OS X, Win, and Linux.

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv



More information about the use-livecode mailing list