Renaming files with javascript math
Posted: Wed Jun 01, 2011 5:11 pm
I need to rename image files of magazine pages based on printed page number. From the original page number I need an image number the counts the cover and inside cover (page number +2) and a spread number ( ((page number/2) - .1) + 1 ) added to the filename. I am trying to use scripting in the rename job module. The code I have so far for the spread number that doesn't do anything in a Replace by script expression:
var pageNumber = job.getVariableAsNumber("[Job.NameProper:Search=(d{3})]");
math.round((pageNumber/2)-.1) + 1;
The image number code would be simpler with just +2.
In the context of the expression am I missing some syntax?
I have only used script expressions to compare metadata to route files.
var pageNumber = job.getVariableAsNumber("[Job.NameProper:Search=(d{3})]");
math.round((pageNumber/2)-.1) + 1;
The image number code would be simpler with just +2.
In the context of the expression am I missing some syntax?
I have only used script expressions to compare metadata to route files.