Page 1 of 1

Renaming files with javascript math

Posted: Wed Jun 01, 2011 5:11 pm
by kylek
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.

Renaming files with javascript math

Posted: Wed Jun 01, 2011 8:12 pm
by dkelly
Hello,



Replace "math.round" with "Math.round" and you won't get a script expression error anymore.



Dwight Kelly

Apago, Inc.

dkelly@apago.com