selectitems chokes on <crlf>-separated list

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
highend
Posts: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

selectitems chokes on <crlf>-separated list

Post by highend »

Create a folder with e.g. 100 files in it. E.g. via powershell:

Code: Select all

$maxCreate = 100
$dstFolder = "R:\tst_files" # ADAPT THE PATH!

# Create destination folder if necessary
if (-Not (Test-Path $dstFolder.trim())) {
    New-Item -Path $dstFolder -ItemType Directory | Out-Null
}

# Create file(s)
$lenPrefix = "$maxCreate".length
for ($i = 1; $i -le $maxCreate; $i++) {
    $prefix = "{0:d$lenPrefix}" -f $i
    Out-File ("$dstFolder\" + $prefix + ".txt") -Encoding ascii
}
Go into this folder in XY, execute this script:

Code: Select all

    $files  = listpane(, , 1+4, <crlf>);
    $select = "";
    $i = 1;
    foreach($file, $files, <crlf>, "e") {
        if ($i % 2 == 0) {  $select .= $file . <crlf>; }
        $i++;
    }
    selectitems $select;
Only these two files are selected:
002.txt
004.txt

Now do it with the "|"-version of the script:

Code: Select all

    $files  = listpane(, , 1+4);
    $select = "";
    $i = 1;
    foreach($file, $files, , "e") {
        if ($i % 2 == 0) {  $select .= $file . "|"; }
        $i++;
    }
    selectitems $select;
One of my scripts helped you out? Please donate via Paypal

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

Re: selectitems chokes on <crlf>-separated list

Post by admin »

Confirmed. Interesting bug. :tup: Only happens when the first file in the list starts with a numeric value (eg "002.txt").
I learned something new here about a certain command in VB, thanks!
Fix coming.

Post Reply