Renaming files with javascript math

Post Reply
kylek
Newbie
Posts: 1
Joined: Wed Jun 01, 2011 4:55 pm

Renaming files with javascript math

Post 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.
dkelly
TOP CONTRIBUTOR
Posts: 658
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Renaming files with javascript math

Post 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
Post Reply