sweety wrote:But 1 Problem left like in the old Code. If you just select and Folder in the Treeview you get the Popup: Secure Deletion Aborted: No Selected Item(s). I have done an screenshot to explaint it better.
Ugh.. it's never enough is it?
Don doesn't provide a way to determine which control has focus (without saving your entire configuration). However, from some tests and thoughts on this I believe we can safely assume most of the time, that if <focitem> and <curpath> are equal the tree has focus. This tends to work fine except in rare cases where you are able to somehow set focus to the current path in the list. (It's possible with searching multiple locations, and perhaps also junctions/linking?)
Note that I don't do any type of checking to ensure you don't run this on an entire drive or My Computer. Ideally, it could also allow you to use Eraser's drive parameter to clear empty space, but I can't think of a way to make this always work.
This is a dangerous tool so treat it as such and use extreme caution.
Code: Select all
//Global variables to define Eraser Parameters.
"_init"
Global($eraser, $options, $fileOptions, $dirOptions);
//Path to Eraserl.exe
$eraser = '..\EraserPortable\App\eraser\eraserl.exe';
//Additional options for files.
$fileOptions = '';
//Additional options for folders.
$dirOptions = '-subfolders';
//Additional arguments that follow items to delete on command line.
$options = '-method DoD_E -queue';
//Request user confirmation before proceeding.
"_confirm"
Global($msg);
$response = Input("Confirmation Requested","The following item(s) will be securely deleted...<crlf><crlf>$msg<crlf><crlf>Type 'yes' to proceed with deletion:");
End(Compare($response, "yes", "i") != 0, "Secure Deletion Aborted:<crlf>Confirmation not acquired.");
"Securely Delete..."
"-"
//Run the correct sub based on which control has focus.
"&Focused Control's Selected Items : focus"
//Run the correct sub based on which control has focus.
Sub((Compare("<curpath>", "<focitem>", "i") == 0) ? "tree" : "list");
//Securely delete the items selected in the list.
"&List's Selected Items : list"
//Abort if nothing is selected.
$count = GetInfo("CountSelected");
End($count < 1, "Secure Deletion Aborted:<crlf>No item(s) selected in list.");
//Request user confirmation.
Global($msg);
$msg = "List's Current Selection:<crlf>" . ($count < 10 ? GetInfo("SelectedItemsPathNames") : "$count selected items.");
Sub("_confirm");
//Delete the items.
Global($eraser, $options, $fileOptions, $dirOptions);
Sub("_init");
$script = Report('Open("""' . $eraser . '"" {Dir -folder|-file|} ""{FullName}"" ' . "{Dir $dirOptions|$fileOptions|} $options"");", "1");
Load($script, "","s");
//Securely delete the current path (Tree selection).
"&Tree's Selected Items : tree"
$cp = "<curpath>";
//Request user confirmation.
Global($msg);
$msg = "Tree's Current Selection:<crlf>$cp";
Sub("_confirm");
//Delete current path.
Global($eraser, $options, $fileOptions, $dirOptions);
Sub("_init");
#523; //Go up a directory.
Open("""$eraser"" -folder ""$cp"" $dirOptions $options");