Order of items dropped on droplet
Order of items dropped on droplet
- Subject: Order of items dropped on droplet
- From: Brennan <email@hidden>
- Date: Sun, 21 Mar 2004 21:05:43 +0100
Hi there,
This is probably some kind of FAQ, but I can't find any info on it.
I'm curious about the order of items in the list fed to the 'open' handler
by the Finder. Sometimes this can be quite important (consider a droplet
which concatenates files, for example).
I had been labouring under the illusion that items are fed to droplets in
alphabetical order, but testing today seems to indicate they are put in
the list in order of creation date, with the earliest first.
First question: Have I got this right? Is creation date the sort order?
Second question: Was it alphabetical in OS9 or something? Where am I
getting this alphabetical order thing from? I am sure I have seen it
somewhere. Perhaps I'm thinking about the Finder selection. (Strictly
speaking, the order of items in the Finder selection should exactly
correspond with the order of items fed to the open handler of a droplet,
no?).
Third question: Now I am playing with alternative ways of ordering the
items dropped onto a droplet, and am wondering whether anyone has any
interesting ideas about this.
The obvious thing is to have a text file containing file names in the
correct order, but that's neither ingenious nor effective if your starting
point is the Finder.
I've also thought about folder action scripts; Having a property in the
script which remembers the order that files were added to the folder.
(Presumably you'd need some way of resetting this too). This is about as
close as I can come to an 'approved' solution.
One effective (but slightly peculiar) approach is to sort them in
'spatial' order based on the Finder icon view. (i.e. left-to-right,
top-to-bottom or whatever).
There was an old app called 'Moviescript' which used this technique
extensively. Apart from it's actual purpose (which is now entirely covered
by Quicktime player's scripting dictionary) it remains one of the most
interesting scriptable applications I have used.
Little more than a faceless background application, Moviescript generated
an elementary GUI from the arrangement of scripts and folders in its own
'scripts' folder. Each folder became a menu and/or a floating palette,
each script became a menu item and/or a palette button (which responded to
drag and drop). Subfolders became submenus, etc. If you removed the
scripts folder, it only had a menu bar with 'About', 'Open...' and
'Quit'. I think there was some special backslash trick for keyboard
shortcuts, similar to the one used by Tex Edit Plus.
The sequence of items presented in the GUI (i.e. palette buttons or menu
items) depended on their Finder icon positions. This was very handy for
tasks which were semi-automated, because you could arrange icons or menu
items for optimal usability when making a manually-operated script.
Neat, but not exactly Mac user interface guidelines. Still, it was a very
straightforward way of building a GUI around a task, rather than
shoehorning a task into a series of 'display dialog' and 'choose from
list' boxes. I can imagine this being useful with all the faceless
background apps which are now replacing the OSAXen of old.
Ah reminisences. Well, back to the nub of my gist. Does anyone have any
great ideas or script snippets for processing files in some kind of
filtered order?
Brennan
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.