Page 1 of 1
selection breaks when an item is deleted
Posted: 24 Nov 2013 22:34
by 40k
It's a fairly uncommon scenario but this bothers me:
When you select any number of items and execute a script that deletes any of the items you have selected the entire selection is lost.
Re: selection breaks when an item is deleted
Posted: 25 Nov 2013 10:32
by admin
Confirmed.
Re: selection breaks when an item is deleted
Posted: 21 Dec 2013 14:31
by 40k
admin wrote:Confirmed.
This issue is still present in 13.5
In addition, I have uncovered similar behavior in a slightly different setting.
When a script deletes an item inside a folder during _Initialize, it will also destroy any list of items that was stored in a variable through the getselecteditempaths method.
Even when the item that is deleted was not part of the initial selection
Code below reproduces behavior:
Code: Select all
"_Initialize"
{
global $g_ExeG;
$g_ExeG = quote('C:\bin\7-Zip\7zG.exe', '0');
global $g_ExeFm;
$g_ExeFm = quote('C:\bin\7-Zip\7zFM.exe', '0');
global $g_ExecutionFile;
$g_ExecutionFile = "<xyscripts>\sevenzip.bat";
/* WHEN THE SCRIPT DELETES THE BAT EXECUTION FILE
ANY SELECTION THAT WAS STORED THROUGH getselecteditemspathnames
IS DESTROYED. */
//writefile($g_ExecutionFile, '', 'o', 't');
delete('0', '0', $g_ExecutionFile);
}
"ZIP - to single files"
{
global $g_ExeG;
global $g_ExecutionFile;
//$CandidatesURIs VALUE IS DESTROYED IF delete('0', '0', $g_ExecutionFile); IS CALLED IN _Initialize
$CandidatesURIs = get('selecteditemspathnames', '|', 'a');
foreach($CandidateURI, $CandidatesURIs, '|'){
$CandidatePath = getpathcomponent($CandidateURI, 'path');
$CandidateName = getpathcomponent($CandidateURI, 'base');
$CandidateExtension = getpathcomponent($CandidateURI, 'ext');
$CandidateURI = quote($CandidateURI, '0');
$ZipURI = quote($CandidatePath.'\'.$CandidateName.'.7z', '0');
$Run = "$g_ExeG a $ZipURI $CandidateURI"."<crlf>";
writefile($g_ExecutionFile, $Run, 'a', 't');
}
run($g_ExecutionFile, , '0', '0');
}