$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

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";
}
XYplorer Beta Club