Is there a way to make a button's action dependent on whether the button was clicked or if files where dragged onto it?
i.e. the button does action "A" when you click it, but does action "B" when you drag files onto it.
I'd like to make a delete button, that skips the Recycle Bin if you drag onto it.
Sounds doable. Here's a little demo script:
function OnClick(clickData) {
var cmd = clickData.func.command;
cmd.deselect = false; // Prevent automatic deselection
if (clickData.func.fromdrop) {
cmd.RunCommand('@confirm:Somebody dropped something on me');
} else {
cmd.RunCommand('@confirm:Somebody pushed me');
}
}
2 Likes
Thanks a lot.
Can anyone please show me how to insert this in that code (following the IF or ELSE command):
dopusrt.exe /cmd delete
Presumably you don't want the @confirm lines in your actual button so you can just replace those with the call to the delete function.
Note that you probably just want to run Delete
and Delete NORECYCLE
directly; if you run them via dopusrt.exe you'll lose which files were selected.
function OnClick(clickData) {
var cmd = clickData.func.command;
cmd.deselect = false; // Prevent automatic deselection
if (clickData.func.fromdrop) {
cmd.RunCommand('Delete NORECYCLE');
} else {
cmd.RunCommand('Delete');
}
}
1 Like
Thanks a lot!