Matching documents by pairing around a middle file

Bulk Rename Utility How-To's

Matching documents by pairing around a middle file

Postby RMcD » Fri Aug 13, 2021 11:39 pm

I'm not sure that title is coherent but let me explain my use case.

I have a document feeder. I scan 50 documents, however it's single sided scans, and not duplex. So after I finish scanning, I flip the whole pile and feed it back through, now upside down.

The files naturally save as

blabla 1
blabla 2
bla...
blabla 50

and then i flip it over and continue

blabla 51
blabla 52
blabla 53

etc

I want to then reorder it so it's something like:

image 1.1 and image 1.2 (originally image 1 and image 100)
...
image 50.1 and image 50.2 (originally image 50 and image 51)

I know it would be more sensible to finish scanning the first side, then do 2*n - 1 on all the numbers so 1 becomes 1 2 becomes 3, 3 becomes 5, and so on such that when i flipped it over but let's imagine that I forgot to do that, oops.
RMcD
 
Posts: 5
Joined: Wed Aug 04, 2021 9:19 am

Re: Matching documents by pairing around a middle file

Postby Luuk » Sat Aug 14, 2021 3:29 am

Javascipt can conduct the math, but Im not understanding the logic for...
1 ====> 1.1
50 ==> 50.1
51 ==> 50.2
100 ==> 1.2
Luuk
 
Posts: 692
Joined: Fri Feb 21, 2020 10:58 pm

Re: Matching documents by pairing around a middle file

Postby RMcD » Sat Aug 14, 2021 9:58 am

Luuk wrote:Javascipt can conduct the math, but Im not understanding the logic for...
1 ====> 1.1
50 ==> 50.1
51 ==> 50.2
100 ==> 1.2


You have a pile of paper.

You place it on the printer.

The first piece of paper scanned is paper 1.

It is saved as image 1.

Then paper 1, image 2.

It scans the front side of the piece of paper for the 50 pieces. You then place the stack back on the printer, except now you flip it over so that it will scan the reverse side of the paper.

The first one it scans comes from the bottom of the pile, so paper 50. So paper 50, side 2, is image 51. The last one it scans will be the first piece of paper.

So 1.1 = front 1.2 = back

Do I need to install something to do javascript or it can do it on bulkrenamer?
RMcD
 
Posts: 5
Joined: Wed Aug 04, 2021 9:19 am

Re: Matching documents by pairing around a middle file

Postby Luuk » Sun Aug 15, 2021 4:50 am

The paid version for BRU does have its own javascript to conduct the math, so there is nothing extra to be installed.
Im guessing the copier always likes to append 'space' before adding numbers at the end, so the numbering conducts like...

Scan first-stack of 50-pages (to scan the fronts) so numbering like...
Now ==> Need
1 ====> 1.1 (pg.1-front)
2 ====> 2.1 (pg.2-front)
3 ====> 3.1 (pg.3-front)
.. ====> ..1 (pg..-front)
50 ==> 50.1 (pg.50-front)

Flip this stack upside-down (to scan the backs) so numbering like...
Now => Need
51 ==> 50.2 (pg.50-back)
52 ==> 49.2 (pg.49-back)
53 ==> 48.2 (pg.48-back)
... ==> ....2 (pg...-back)
100 ==> 1.2 (pg.1-back)

Scan second-stack of 50-pages (to scan the fronts) so numbering like...
Now ==> Need
101 ==> 51.1 (pg.51-front)
102 ==> 52.1 (pg.52-front)
.... ==> ....1 (pg....-front)
150 => 100.1 (pg.100-front)

Flip second-stack over (to scan the backs) so numbering like...
Now ==> Need
151 ==> 100.2 (pg100-back)
152 ===> 99.2 (pg.99-back)
.... ===> ....2 (pg....-back)
200 ===> 51.2 (pg.51-back)



So really the best way to fix any numbering like this, especially if its a lot of paper stacks, is with the javascript code.
If you like to experiment, or with the paid version, you can put this code into the menu 'Special, Javascript Renaming'...

stack=50
fstart=name.replace(/(.+ )\d+$/, '$1' )
fnumbr=name.replace(/.+ (\d+)$/, '$1' )
if (/ \d+$/.test(name)) {

// Front Pages
if ((Math.ceil(fnumbr/stack)) % 2 == 1) {
newName= fstart + (fnumbr-(Math.floor(fnumbr/(stack*2)))*stack) + '-front'}

// Back Pages
if ((Math.ceil(fnumbr/stack)) % 2 == 0) {
mult=Math.ceil(fnumbr/(stack*2))
newName= fstart + (fnumbr-(((2*mult*stack)-1) - (2*((2*mult*stack)-fnumbr)) - ((mult-1)*stack))) + '-back'}}


Bru will present all changes inside the "New Name" column, but the Rename button wont conduct without having the paid license.
The good part for this method, is that if you are scanning different sized stacks, then you could just edit the stack=50 line.
Another way could be using very many regexes, but if its more than just one stack or two, its probably not really worth it.

If you have the paid version, please to change -front ==> .1 and -back ==> .2 so the names can be like your description.
If I can think of another way, or any better solutions to conduct this math, I will try to post them here again.
It seems like someone else did ask this before, but now Im not finding it anywhere, so maybe he can find this one.
Luuk
 
Posts: 692
Joined: Fri Feb 21, 2020 10:58 pm

Re: Matching documents by pairing around a middle file

Postby Admin » Mon Aug 16, 2021 2:23 am

Very nice work Luuk ! 8) 8)

Yes, if you use Javascript renaming, please purchase a commercial BRU license if you can, thank you
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm


Return to How-To