selection breaks when an item is deleted

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
40k
Posts: 234
Joined: 09 Dec 2011 21:25

selection breaks when an item is deleted

Post 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.
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial

admin
Site Admin
Posts: 67282
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: selection breaks when an item is deleted

Post by admin »

Confirmed.

40k
Posts: 234
Joined: 09 Dec 2011 21:25

Re: selection breaks when an item is deleted

Post 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');
 }
I develop scripts that integrate media functionality into Xyplorer.
Hash - Twitch.tv in VLC (NEW 2.0!) - FFmpeg GUI - Youtube downloading
XYplorer for Linux! Tutorial

Post Reply