[SOLVED] Check for odd number of pages

Post Reply
abonsey
Member
Posts: 140
Joined: Fri May 24, 2013 5:10 pm

[SOLVED] Check for odd number of pages

Post by abonsey » Thu Sep 17, 2020 11:58 am

I know I can use Pitstop Server preflights to check for an odd number of pages in a document but I'm looking to keep things tidy and do it with a branch of a flow using Stats.NumberOfPages (see attached).
Do anybody know/care to share how I could do that via the scripting expression?

TIA
Attachments
Screenshot 2020-09-17 at 10.55.55.png
Screenshot 2020-09-17 at 10.55.55.png (21.9 KiB) Viewed 449 times
Last edited by abonsey on Thu Sep 17, 2020 2:59 pm, edited 1 time in total.

mkayyyy
Member
Posts: 31
Joined: Mon Nov 21, 2016 6:31 pm
Location: UK

Re: Check for odd number of pages

Post by mkayyyy » Thu Sep 17, 2020 1:00 pm

Off the top of my head I can't figure out doing it through Define conditions with variables, but doing it fully in a Script expression on a connection would be done like this:

Code: Select all

var numberOfPages = (new FileStatistics(job.getPath())).getNumber("NumberOfPages");

(numberOfPages % 2 == 0);

abonsey
Member
Posts: 140
Joined: Fri May 24, 2013 5:10 pm

Re: Check for odd number of pages

Post by abonsey » Thu Sep 17, 2020 2:59 pm

FYI
Got there in the end

[Switch.Calculation:Expression="([Stats.NumberOfPages]%2)"]

mkayyyy
Member
Posts: 31
Joined: Mon Nov 21, 2016 6:31 pm
Location: UK

Re: Check for odd number of pages

Post by mkayyyy » Thu Sep 17, 2020 6:29 pm

abonsey wrote:
Thu Sep 17, 2020 2:59 pm
FYI
Got there in the end

[Switch.Calculation:Expression="([Stats.NumberOfPages]%2)"]
Ah! Can't believe I didn't think of that

Post Reply