Hi all,
I have a script that does several transformations for normalizing file names, one of which is to run the capitalization command #126;. In this case, however, I do not want the preview popup and don't want to be informed about whether only some or none of the names are actually changed. I don't want to have to otherwise first change a related global configuration option to turn off the preview. I see that there is a preview parameter to the rename function, but I don't see a way to use the "Aaa Aa.*" pattern with that function. I also didn't see an alternative scripting function for doing the 126; command.
So how can I omit the preview with #126; when used in a script?
How to omit preview with #126; in a script?
-
Jerry
- Posts: 835
- Joined: 05 May 2010 15:48
- Location: The UnUnited States of America
How to omit preview with #126; in a script?
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, over 26 external USB3 drives attached via multiple powered hubs with letters and mount points, totaling 120+ TB. SCREEN SCALING: 125%
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: How to omit preview with #126; in a script?
Currently this is the only way to achieve this accurately:
As you can see this method requires saving the configuration (just xyplorer.ini) - as that's the only way to get the current state of the Preview All setting.
If you never toggle Preview All you could shorten this to just:
However, this depends on the script always starting from that known state.
Code: Select all
"126 without Previews"
#193; //File | Settings | Save Configuration
$PreviewRenameSpecial = GetKey('PreviewRenameSpecial', 'Settings'); //Reads the current state of Preview All from xyplorer.ini.
if ($PreviewRenameSpecial == 1) {
//Disable Previews
#148; //File | Rename Special | Preview All
}
#126; //File | Rename Special | Aaa Aa.*
if ($PreviewRenameSpecial == 1) {
//Enable Previews
#148; //File | Rename Special | Preview All
}If you never toggle Preview All you could shorten this to just:
Code: Select all
"126 without Previews"
//Disable Previews
#148; //File | Rename Special | Preview All
#126; //File | Rename Special | Aaa Aa.*
//Enable Previews
#148; //File | Rename Special | Preview All-
Jerry
- Posts: 835
- Joined: 05 May 2010 15:48
- Location: The UnUnited States of America
Re: How to omit preview with #126; in a script?
Ok, I guess that will have to do, though it is cumbersome. I think Don ought to add a function for doing this kind of rename with the appropriate options. Thanks.
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, over 26 external USB3 drives attached via multiple powered hubs with letters and mount points, totaling 120+ TB. SCREEN SCALING: 125%
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: How to omit preview with #126; in a script?
It's possible to achieve the same results (I believe) without using #126, but it involves looping through all of the selected items and using recase followed by renameItem on each:
Code: Select all
"Similar to #126..."
$items = Report("{Basename}|{Fullname}<crlf>", 1);
foreach ($token, "$items", "<crlf>") {
if ("$token" UnLike '') {
$base = GetToken("$token", 1, '|');
$item = GetToken("$token", 2, '|');
$base = Recase("$base", 'Title');
RenameItem("$base", "$item");
}
}-
Jerry
- Posts: 835
- Joined: 05 May 2010 15:48
- Location: The UnUnited States of America
Re: How to omit preview with #126; in a script?
Hmm.. Actually, I think I'll adapt your bit of script because ideally, when I do these case renames, I prefer words like "the", "and", "of", "a" etc. to not be capitalized. So I could achieve that with the addition of an inner loop where each each word in $base is selectively recased.TheQwerty wrote:It's possible to achieve the same results (I believe) without using #126, but it involves looping through all of the selected items and using recase followed by renameItem on each:
Running on Windows 10 Pro 64-bit quad-core ASUS G752-VY notebook with 64 GB RAM, over 26 external USB3 drives attached via multiple powered hubs with letters and mount points, totaling 120+ TB. SCREEN SCALING: 125%
XYplorer Beta Club