Page 1 of 1
Specifying the number of document sheets in the name when renaming files in bulk
Posted: 24 Sep 2023 21:10
by OIV88
Please tell me if there is a similar WDX plugin xpdfsearch (works in total) script /plugin for XY?
The task is as follows:
Is it possible that when renaming, the number of sheets of the file being renamed should be indicated (interested only in pdf)?
That is, there are for example 3 files: text_document 1.pdf and 2, 3. In 1 - 3 sheets, in 2 - 4, sheets, in 3 - 10 sheets. The task is to add to the file name the number of sheets of which it consists, so that the output would have - text_document 1_3l.pdf; text_document 2_4l.pdf; text_document 3_10l.pdf.
Currently I use the TC for renaming, but the permanent manager built into the vin is XY, so it would be more convenient to do everything in one place
If possible, please describe how to use these?
Thanks!
Re: Specifying the number of document sheets in the name when renaming files in bulk
Posted: 24 Sep 2023 21:27
by highend
Scripting is the way to go...
You need:
https://github.com/oschwartz10612/poppl ... s/releases
and ofc adapt the path to it in the script...
Code: Select all
$pdfInfo = "D:\Tools\@Command Line Tools\poppler_x64\pdfinfo.exe";
end (exists($pdfInfo) != 1), quote($pdfInfo) . " not found, aborted!";
setting "BackgroundFileOps", 0;
foreach($item, <get SelectedItemsPathNames>, <crlf>, "e") {
$path = gpc($item, "path");
$base = gpc($item, "base");
$result = runret(lax("$pdfInfo" "$item"), , 65001);
$pages = regexmatches(regexmatches($result, "^Pages:.+?$"), "\d+$");
if !($pages) { continue; }
$name = $base . "_" . $pages . "l.pdf";
renameitem($name, $item);
}
Re: Specifying the number of document sheets in the name when renaming files in bulk
Posted: 24 Sep 2023 21:33
by admin
Don't know where it comes from but I have a shell property "Pages" here that does the job for PDFs and DOCXs.
Re: Specifying the number of document sheets in the name when renaming files in bulk
Posted: 24 Sep 2023 22:02
by highend
Maybe MS Office is installed?
Re: Specifying the number of document sheets in the name when renaming files in bulk
Posted: 24 Sep 2023 22:04
by OIV88
Thank you very much for the quick answers!
Is it possible to go into more detail on how to implement all this in the program?
Unfortunately, I don't understand these issues

Was very grateful for the help
Re: Specifying the number of document sheets in the name when renaming files in bulk
Posted: 25 Sep 2023 08:10
by admin
highend wrote: ↑24 Sep 2023 22:02
Maybe MS Office is installed?
Yep, that was it, compared the dates (using Registry Workshop).
Re: Specifying the number of document sheets in the name when renaming files in bulk
Posted: 25 Sep 2023 09:13
by highend
Yep, that was it
Doesn't seem to be the only necessary thing.
Tried 2010, 2013, 2016, 2019 and 2021 and none of them lead to a number for the pages property of a .pdf
Additionally installed a full pdf reader (Foxit), still no pages property filled...
Is it possible to go into more detail on how to implement all this in the program?
Put that script e.g. on a button.
Menu - Help - Contents and Index
Main Topics - Toolbar - Custom Toolbar Buttons
How to add a User Button: To add a new user button to the toolbar you first open the Customize Toolbar dialog (menu Tools) and add a User Button (bottom of the list) to the current buttons. Then you right-click the button in the toolbar and select Edit... In the Edit User Button dialog you set the Name and Icon (both optional) for the button, and at least one Script (required) that is triggered when clicking the button. That's all. Of course, the buttons are stored between sessions and portable.