silly (but huge) bug in the Attach Script to Folder script
silly (but huge) bug in the Attach Script to Folder script
- Subject: silly (but huge) bug in the Attach Script to Folder script
- From: Matt Neuburg <email@hidden>
- Date: Sat, 16 Jul 2005 09:16:42 -0700
Stop me if you've heard this one.
Apple includes some example scripts in /Library/Scripts. One of these is
Attach Script to Folder, which asks for a script and a folder and attaches
the script to the folder through a folder action object.
The bug is that the script examines existing folder action objects by
*name*. If the *name* of a folder action object is the same as the *name* of
the folder the user chose, that folder action is used - the script is
attached to this folder action object, instead of creating a new folder
action object. But since the *path* of that folder action object (the actual
folder to which it points) could be anything at all - the name initially
comes from the folder, but it can be changed, and in any case, don't you
have two folders with the same name in different places on your hard disk? -
the script may well end up attached to the wrong folder, not the one the
user chose.
I darned near spilled my coffee when I saw this. m.
PS Even though the whole "name" thing is utterly silly, the writer did have
a serious purpose in mind. There's a major flaw in the folder actions
architecture: you can have more than one folder action object pointed at the
same folder, but only the first one will have any effect - the others are
ignored. Therefore the impulse to prevent a second folder action object from
pointing at the same folder was correct.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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