Access Stats.* in script

Post Reply
mclarke
Member
Posts: 54
Joined: Thu Feb 28, 2013 5:29 pm
Location: Syracuse, NY

Access Stats.* in script

Post by mclarke »

I'm trying to write my first script, which checks whether the NumberOfPages stat is divisible by four (4). I can't figure out how to get access to the stats of the file.

Does anyone have a sample script I could learn from that does the check? I was going tol use modulo and return a Boolean result.

Thanks in advance.
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Access Stats.* in script

Post by jan_suhr »

Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
mclarke
Member
Posts: 54
Joined: Thu Feb 28, 2013 5:29 pm
Location: Syracuse, NY

Re: Access Stats.* in script

Post by mclarke »

Thanks, that was helpful.
allsystems
Newbie
Posts: 6
Joined: Fri Mar 16, 2018 12:33 pm

Re: Access Stats.* in script

Post by allsystems »

var numberOfPages = job.getVariableAsNumber("[Stats.NumberOfPages]");
var modOperator = 4;//this is the number of pages you want to check
var modCheck = false;//set the check to false

if(numberOfPages%modOperator==0){
modCheck = true;
}
mclarke
Member
Posts: 54
Joined: Thu Feb 28, 2013 5:29 pm
Location: Syracuse, NY

Re: Access Stats.* in script

Post by mclarke »

Thanks AllSystems. I will try that one out, also!
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Access Stats.* in script

Post by gabrielp »

Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
mclarke
Member
Posts: 54
Joined: Thu Feb 28, 2013 5:29 pm
Location: Syracuse, NY

Re: Access Stats.* in script

Post by mclarke »

I'll check it out, thanks.
Post Reply