Hi!
I made this script(go easy on me because i'm a noob), and it runs fine for a few times like 5 or 6 and then xyplorer freezes.
specs: 64gb RAM; ryzen 3900x; rtx 3090; 16TB black HD
The script does the following:
gets all files with same name until last underscore, create folder with that name and put files inside.
Each folder has around 100mb of image files.
I don't think its RAM problem, but i ran outta options. My XYplorer is up to date.
Maybe HD cache?
Is there a way to troubleshoot this problem?
Thanks!
Script works well but freezes XYplorer after 6 iterations
-
guimcast@gmail.com
- Posts: 10
- Joined: 04 Jun 2023 17:56
Script works well but freezes XYplorer after 6 iterations
To see the attached files, you need to log into the forum.
-
highend
- Posts: 14925
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Script works well but freezes XYplorer after 6 iterations
That's a mess, no time to debug that...
Would this one fit your needs?
Would this one fit your needs?
Code: Select all
$items = <get SelectedItemsNames>;
end ($items == ""), "Select something";
if !(regexmatches(regexreplace($items, "\.[^.]+?$"), "[0-9]")) { end true; }
showstatus 0;
setting "BackgroundFileOps", 0;
$strToFind = "_";
while ($items) {
$firstItem = gettoken($items, 1, <crlf>);
$tillStrToFind = regexmatches($firstItem, "^.+" . $strToFind . "\d+");
$escaped = regexreplace($tillStrToFind, "([\\^$.+()\[{])", "\$1");
$pattern = "^" . $escaped . ".*?";
$matches = regexmatches($items, $pattern . "$");
if ($tillStrToFind) {
moveto $tillStrToFind, $matches, , 2, 2;
$items = regexreplace($items, $pattern . "(\r?\n|$)");
} else {
$items = gettoken($items, 2, <crlf>, , 2);
}
wait 1;
}
One of my scripts helped you out? Please donate via Paypal
-
guimcast@gmail.com
- Posts: 10
- Joined: 04 Jun 2023 17:56
Re: Script works well but freezes XYplorer after 6 iterations
Wow, so fast. Thank you!
But... as you can see, these are the files(for example):
cg1_asphalt_pavement_1.jpg
cg1_asphalt_pavement_1_diffuse.png
cg1_asphalt_pavement_1_glossiness.png
cg1_asphalt_pavement_1_height.png
cg1_asphalt_pavement_1_normal.png
cg1_asphalt_pavement_1_reflection.png
cg1_asphalt_pavement_2.jpg
cg1_asphalt_pavement_2_diffuse.png
cg1_asphalt_pavement_2_glossiness.png
cg1_asphalt_pavement_2_height.png
cg1_asphalt_pavement_2_normal.png
cg1_asphalt_pavement_2_reflection.png
cg1_asphalt_pavement_3.jpg
cg1_asphalt_pavement_3_diffuse.png
cg1_asphalt_pavement_3_glossiness.png
cg1_asphalt_pavement_3_height.png
cg1_asphalt_pavement_3_normal.png
cg1_asphalt_pavement_3_reflection.png
Your script created one folder (cg1_asphalt_pavement_) and move all files to it.
I actually need it to go to separate folders such as:
cg1_asphalt_pavement_1
cg1_asphalt_pavement_2
cg1_asphalt_pavement_3
Tell me if you need more info, thanks!
But... as you can see, these are the files(for example):
cg1_asphalt_pavement_1.jpg
cg1_asphalt_pavement_1_diffuse.png
cg1_asphalt_pavement_1_glossiness.png
cg1_asphalt_pavement_1_height.png
cg1_asphalt_pavement_1_normal.png
cg1_asphalt_pavement_1_reflection.png
cg1_asphalt_pavement_2.jpg
cg1_asphalt_pavement_2_diffuse.png
cg1_asphalt_pavement_2_glossiness.png
cg1_asphalt_pavement_2_height.png
cg1_asphalt_pavement_2_normal.png
cg1_asphalt_pavement_2_reflection.png
cg1_asphalt_pavement_3.jpg
cg1_asphalt_pavement_3_diffuse.png
cg1_asphalt_pavement_3_glossiness.png
cg1_asphalt_pavement_3_height.png
cg1_asphalt_pavement_3_normal.png
cg1_asphalt_pavement_3_reflection.png
Your script created one folder (cg1_asphalt_pavement_) and move all files to it.
I actually need it to go to separate folders such as:
cg1_asphalt_pavement_1
cg1_asphalt_pavement_2
cg1_asphalt_pavement_3
Tell me if you need more info, thanks!
-
highend
- Posts: 14925
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Script works well but freezes XYplorer after 6 iterations
Get the code again, it now acts accordingly to your example names...
One of my scripts helped you out? Please donate via Paypal
-
guimcast@gmail.com
- Posts: 10
- Joined: 04 Jun 2023 17:56
Re: Script works well but freezes XYplorer after 6 iterations
Thanks! Now i get it 
I modified it a lil bit. Added possibility to search from start or from end.
Thanks again!
I modified it a lil bit. Added possibility to search from start or from end.
Code: Select all
$items = <get SelectedItemsNames>;
end ($items == ""), "Select something";
if !(regexmatches(regexreplace($items, "\.[^.]+?$"), "[0-9]")) { end true; }
showstatus 0;
setting "BackgroundFileOps", 0;
$mode = "end"; // you can switch this to "start" to change the behavior
while ($items) {
$firstItem = gettoken($items, 1, <crlf>);
if ($mode == "end") {
$tillStrToFind = regexmatches($firstItem, "^.+_[0-9]+");
} elseif ($mode == "start") {
$tillStrToFind = regexmatches($firstItem, "^[^_]+");
}
$escaped = regexreplace($tillStrToFind, "([\\^$.+()\[{])", "\$1");
$pattern = "^" . $escaped . ".*?";
$matches = regexmatches($items, $pattern . "$");
if ($tillStrToFind) {
moveto $tillStrToFind, $matches, , 2, 2;
$items = regexreplace($items, $pattern . "(\r?\n)?");
} else {
$items = gettoken($items, 2, <crlf>, , 2);
}
wait 1;
}Thanks again!
XYplorer Beta Club