Hi all -
I wrote a script that takes the filename and scale percentage of every image in a file and puts it in a text box. The problem I am having is that when I add in a rounding script that I found, the script gives me an undefined variable error. Could anyone give some tips on how I can re-arrange the script to make the rounding part work?
Thanks so much!!
tell application "Adobe InDesign CS2"
tell active document
set IDLinks to links
set Info3 to make paragraph style with properties {name:"Para_style", applied font:"Platinum", point size:9, justification:center align}
repeat with myCounter from 1 to (count IDLinks)
try
set LinkName to name of item myCounter of IDLinks as string
set theImage to parent of item myCounter of IDLinks
set horScale to horizontal scale of theImage as string
set geobounds to geometric bounds of theImage
set truncScale to the result of roundThis(horScale, 2)
end try
set myLayer to make text frame with properties {geometric bounds:{(item 3 of geobounds) + 0.02, item 2 of geobounds, (item 3 of geobounds) + 0.25, item 4 of geobounds}}
set vertical justification of text frame preferences of myLayer to center align
set applied paragraph style of insertion point -1 of myLayer to Info3
--this is where i get an error: variable truncscale is not defined.
set contents of myLayer to ((LinkName) & " Scaled @ " & (truncScale) & "%")
end repeat
end tell
end tell
roundThis(horScale, 2)
on roundThis(n, numDecimals)
set x to 10 ^ numDecimals
(((n * x) + 0.5) div 1) / x
end roundThis