Page 1 of 1

selectitems chokes on <crlf>-separated list

Posted: 28 Mar 2020 00:06
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;

Re: selectitems chokes on <crlf>-separated list

Posted: 28 Mar 2020 12:02
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.