Help with a script
-
Memyself
- Posts: 20
- Joined: 25 Jan 2021 18:13
Help with a script
Just one more point: is it possible to highlight each jpg when the loop is executed?
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Help with a script
Does that mean that you have the folder in which the .jpg files reside opened in dual pane mode in the other pane?
If that's the case, show a screenshot...
If that's the case, show a screenshot...
One of my scripts helped you out? Please donate via Paypal
-
Memyself
- Posts: 20
- Joined: 25 Jan 2021 18:13
Help with a script
The jpg and the "renames" are in the same folder in a single pane.
As you can see from the attached printscreen, when a jpg is selected for renaming, the jpg itself is not highlighted. This makes it to difficult to locate the relevant jpg before accepting to rename or skip it, as the menu itself keeps jumping on the screen from one selection to the next.
As you can see from the attached printscreen, when a jpg is selected for renaming, the jpg itself is not highlighted. This makes it to difficult to locate the relevant jpg before accepting to rename or skip it, as the menu itself keeps jumping on the screen from one selection to the next.
To see the attached files, you need to log into the forum.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Help with a script
Code: Select all
end (<get countselected> == 0), "No item(s) selected, aborted!";
$dstFolder = inputfolder(, "Choose folder where the .jpg(s) reside");
$prefix = gettoken($dstFolder, -1, "\");
$jpgFiles = listfolder($dstFolder, "*.jpg", 1+4, <crlf>);
end (!$jpgFiles), "No .jpg file(s) found in destination folder, aborted!";
$menu = regexreplace(<get SelectedItemsNames <crlf>>, "^(.+?)(\.[^.]+?)(?=\r?\n|$)", "$1");
foreach($jpgFile, $jpgFiles, <crlf>, "e") {
selectitems $jpgFile, , 1;
colorfilter($jpgFile . ">FFFFFF,00FF00");
#1012; // Move focused item into view
$suffix = inputselect("Suffix for $jpgFile", $menu, <crlf>, 4+32+4096+8192+16384, "not_named", 400, 600);
if ($suffix LikeI "not_named") { continue; }
renameitem("$prefix $suffix", $dstFolder . "\" . $jpgFile, 1, "-01");
}
One of my scripts helped you out? Please donate via Paypal
-
Memyself
- Posts: 20
- Joined: 25 Jan 2021 18:13
Help with a script
One last thing: how do you stop the menu from jumping across the screen when it goes through the loop?
To see the attached files, you need to log into the forum.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Help with a script
That dialog window should be centered on the screen each time it appears and not wander around...
One of my scripts helped you out? Please donate via Paypal
-
Memyself
- Posts: 20
- Joined: 25 Jan 2021 18:13
Help with a script
How shall the script be modified to stop the menu from wandering around??
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Help with a script
The script is not responsible for the dialog to appear in a different position and it can't fix it.
Don't know what's causing this on your system...
Don't know what's causing this on your system...
One of my scripts helped you out? Please donate via Paypal
-
Memyself
- Posts: 20
- Joined: 25 Jan 2021 18:13
Help with a script
You are right. The dialog appears always in the center of the screen. I am wondering whether it is possible to freeze the dialog in a fixed position throughout the execution of the script.
Another point that I noticed is that the highlighted jpg does not appear in the preview pane during the script execution. Is this a limitation of the application or can it be sorted out? This could be another way of overcoming the fact that during the execution of the script the dialog hides the highlighted jpg.
Another point that I noticed is that the highlighted jpg does not appear in the preview pane during the script execution. Is this a limitation of the application or can it be sorted out? This could be another way of overcoming the fact that during the execution of the script the dialog hides the highlighted jpg.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Help with a script
Adapt the path to the .exe in the script and the position variables as well!
Code: Select all
// Position of the XYplorer inputselect() window
$xPos = 200;
$yPos = 150;
$rememberPositionExe = "D:\Tools\Remember XYplorer inputselect window.exe";
// ========================================================================
// == DO NOT CHANGE ANYTHING BELOW IF YOU DO NOT KNOW WHAT YOU ARE DOING ==
// ========================================================================
$winTitle = "XYplorer inputselect";
end (<get countselected> == 0), "No item(s) selected, aborted!";
$dstFolder = inputfolder(, "Choose folder where the .jpg(s) reside");
$prefix = gettoken($dstFolder, -1, "\");
$jpgFiles = listfolder($dstFolder, "*.jpg", 1+4, <crlf>);
end (!$jpgFiles), "No .jpg file(s) found in destination folder, aborted!";
if (exists($rememberPositionExe) == 1) {
run """$rememberPositionExe"" $xPos $yPos ""$winTitle""";
}
$menu = regexreplace(<get SelectedItemsNames <crlf>>, "^(.+?)(\.[^.]+?)(?=\r?\n|$)", "$1");
foreach($jpgFile, $jpgFiles, <crlf>, "e") {
selectitems $jpgFile, , 1;
colorfilter($jpgFile . ">FFFFFF,00FF00");
#1012; // Move focused item into view
$suffix = inputselect("Suffix for $jpgFile", $menu, <crlf>, 4+32+4096+8192+16384, "not_named", 400, 600, $winTitle);
if ($suffix LikeI "not_named") { continue; }
renameitem("$prefix $suffix", $dstFolder . "\" . $jpgFile, 1, "-01");
}
copytext "QUIT";
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal
-
klownboy
- Posts: 4481
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440
Re: Help with a script
Curious though as to why the inputselect box was moving around for Memyself I tried the script in a number of views including tiles and thumbnail views and got no movement. At first I thought it might be the setting PopupMenusAtSelection=0 | 1, but it had no affect for SC inputselect. Though maybe it's another setting is affecting it.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Help with a script
He moved it himself...
One of my scripts helped you out? Please donate via Paypal
-
klownboy
- Posts: 4481
- Joined: 28 Feb 2012 19:27
- Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440
Re: Help with a script
Ha Ha! Maybe it was me, myself or I. 
-
Memyself
- Posts: 20
- Joined: 25 Jan 2021 18:13
Help with a script
Thank you very much, it now works as intended.
Could you please clarify why the highlighted jpg does not appear in the preview pane during the script execution?
Thank you.
Could you please clarify why the highlighted jpg does not appear in the preview pane during the script execution?
Thank you.
XYplorer Beta Club