Article View: adobe.scripting.indesign
Article #2186[CS3][JS] How to turn negative number in array into string
From: Tom_Tomasko
Date: Mon, 12 Jan 2009 00:48
Date: Mon, 12 Jan 2009 00:48
19 lines
1866 bytes
1866 bytes
Hello, I have a script that compares the array of the geometric bounds of all text frames to the margins for a document (all pages having the same margins). Any frames that do not match the margins are flagged. In order to compare the array of text frame geometric bounds to two arrays of margins (because they are facing pages), I have to convert the numbers to strings. My problem is that in the following snippet of code that creates the two margin arrays, the negative of the variables become numbers again. This would not be too difficult to solve except that all the numbers have to be 4 decimal points before converted to strings. Thanks, Tom var myDoc = app.activeDocument; var marginY1 = myDoc.pages.item(0).marginPreferences.top.toFixed(4); var marginX1 = myDoc.pages.item(0).marginPreferences.left.toFixed(4); var marginY2 = (myDoc.documentPreferences.pageHeight - myDoc.pages.item(0).marginPreferences.bottom).toFixed(4); var marginX2 = (myDoc.documentPreferences.pageWidth - myDoc.pages.item(0).marginPreferences.right).toFixed(4); var marginsRHand = [marginY1, marginX1, marginY2, marginX2]; var marginsLHand = [marginY1, -marginX2, marginY2, -marginX1];
Technical Details
Message-ID:
<59b77ce0.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!flph200.ffdc.sbc.com!prodigy.net!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,fbee974edb43f64,start X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Tom_Tomasko@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!news.astraweb.com!border5.newsrouter.astraweb.com!flph200.ffdc.sbc.com!prodigy.net!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: [CS3][JS] How to turn negative number in array into string Message-ID: <59b77ce0.-1@webcrossing.la2eafNXanI> Date: Sun, 11 Jan 2009 16:48:53 -0800 Lines: 28 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit