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.
Access Stats.* in script
Re: Access Stats.* in script
Thanks, that was helpful.
-
- Newbie
- Posts: 6
- Joined: Fri Mar 16, 2018 12:33 pm
Re: Access Stats.* in script
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;
}
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;
}
Re: Access Stats.* in script
Thanks AllSystems. I will try that one out, also!
Re: Access Stats.* in script
Here is another way to do it: https://github.com/open-automation/swit ... expression
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.
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.
Re: Access Stats.* in script
I'll check it out, thanks.