Re: a secure delete droplet
Re: a secure delete droplet
- Subject: Re: a secure delete droplet
- From: Kai <email@hidden>
- Date: Tue, 11 Mar 2003 04:19:19 +0000
on Tue, 11 Mar 2003 00:48:01 +0000, Nigel Garvey wrote:
>
email@hidden (Michael Slomski) wrote on Mon, 10 Mar 2003
>
08:42:59 +0100:
>
>
>Hello Roy,
>
>
>
>Someone pointed out, that if you drag an alias on a dropplet, the alias is
>
>always resolved first. So your dropplet will delete the original, not the
>
>alias!
>
>So be shure, that you want this behavior. I don't know how to fix this, but
>
>we have a lot of applescripters here on the list, so perhaps one will
>
>enlighten us/me :-)
>
>
You could make use of the fact that items dragged to a droplet have
>
necessarily been selected first and simply tell the Finder to delete the
>
selection. This is obviously only good for items dragged from a Finder
>
window. Many would advise against relying on the Finder's 'selection', as
>
it might change in the instant between the drop and the script's
>
reaction; but that's unlikely and I don't know of any other recourse in
>
this case - apart from doing something radical like dragging the stuff
>
straight to the trash instead of to a droplet. ;-)
I suppose you could always compare the dropped item(s) against the Finder's
selection - and return an error if such a problem arises:
=========
on open d
tell application "Finder"
try
set s to selection as alias list
on error
set s to selection as alias as list
end try
if s is not d then
try
if (count s) is not (count d) then error
repeat with i in s
if i is not in d then
if i's original item as alias is not in d then error
end if
end repeat
on error
display dialog "Droplet failed. Please try again..." buttons [NoBreak]
{"Cancel"} default button 1 with icon 0
end try
end if
end tell
-- [continue with script - substituting s for d]
end open
=========
--
Kai
_______________________________________________
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.