Page 1 of 1

Using selectitems $matches multiple file selection does not work

Posted: 19 Oct 2025 08:07
by star
`$matches` contains full paths separated by the `|` symbol, but when I run the script, nothing happens. Only after pressing F2 to enter rename mode and then exiting, running the script can select files. Why is this happening? I asked AI, and it said XYPlorer’s directory caching mechanism might be causing the problem, suggesting adding `#500; wait 100;` might help, but I tried it and it didn’t work.

$matches=I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\VariouSketch 2(C86)|I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\生イキ狂イ ~生意気娘をわからせ快楽狂いに~(C101)|I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\私のいちばん恥ずかしいところ。(COMIC1☆11)

3 files:
VariouSketch 2(C86)
生イキ狂イ ~生意気娘をわからせ快楽狂いに~(C101)
私のいちばん恥ずかしいところ。(COMIC1☆11)

How can I make `selectitems $matches;` work successfully to select multiple files? Operation details are shown in the image below.

https://i.imgur.com/iuUp4Bv.gif
Image

Code: Select all

// XYplorer Script: Select Similar (robust encoding)
  $python = "C:\ProgramData\anaconda3\envs\python312\python.exe";
  $pyscript = "C:\Users\Administrator\Personal_scripts\Python\PythonScripts\PythonScripts\src\select_similar.py";
  $tempfile = "%temp%\filelist.txt";

  // --- 1. write file(utf-16-le) ---
  $items = folderreport("dirs", "r", "<curpath>", "<crlf>");
  writefile($tempfile, $items);
  //msg $items;

  // --- 2. Python output---
  $cmd = """$python"" ""$pyscript"" ""$tempfile"" 2>&1";
  $output = runret($cmd);

  // --- 3. Python Error ---
  if (strpos($output, "Traceback") != -1 || strpos($output, "Error") != -1 || strpos($output, "Exception") != -1) {
    msg "⚠️ Python Error:<crlf><crlf>$output";
    end 1;
  }

  // --- 4. Python output(UTF-16-LE) ---
  if (exists($tempfile)) {
    $matches = readfile($tempfile, "utf16-le"); // Python 写回时固定 UTF-16-LE
    // msg $matches;
    if ($matches != "") {
      selectitems $matches;
      msg $matches;
    } else {
      msg "No matches";
    }
  } else {
    msg "❌ Not find file:$tempfile";
  }

Re: Using selectitems $matches multiple file selection does not work

Posted: 28 Oct 2025 12:57
by admin
Are these three items files or folders? If they are folders, do they have a trailing slash? If so, the problem is explained: it is a bug. It will be fixed in the next beta version.

Re: Using selectitems $matches multiple file selection does not work

Posted: 01 Nov 2025 11:18
by star
admin wrote: 28 Oct 2025 12:57 Are these three items files or folders? If they are folders, do they have a trailing slash? If so, the problem is explained: it is a bug. It will be fixed in the next beta version.

If you can see the GIF, it's obvious that they are folders. The small icons on the left of these three folders display the folder icon.


According to the screenshot, the path returned by Python does not end with a backslash (\). I have already shown the msg $matches above.


msg $matches show:

Code: Select all

I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\VariouSketch 2(C86)|I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\生イキ狂イ ~生意気娘をわからせ快楽狂いに~(C101)|I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\私のいちばん恥ずかしいところ。(COMIC1☆11)
I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\VariouSketch 2(C86)
I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\生イキ狂イ ~生意気娘をわからせ快楽狂いに~(C101)
I:\BaiduNetdiskDownload\待净化\soul-ibm5100-6810-20250504\6810-[ほおぶくろっ! (ベコ太郎)] part1\1. 同人志\私のいちばん恥ずかしいところ。(COMIC1☆11)


Additionally, if I use Python to rename a bunch of folders and then perform a selection operation, sometimes the folders that were renamed by the script are not selected by XYPlorer.

Re: Using selectitems $matches multiple file selection does not work

Posted: 08 Nov 2025 14:20
by admin
Sorry, can't explain your issues. It works fine here. :|