Article View: adobe.scripting.indesign
Article #2312AS to JS translation questions
From: Eric
Date: Tue, 23 Dec 2008 22:50
Date: Tue, 23 Dec 2008 22:50
36 lines
1778 bytes
1778 bytes
Hi all,
Still trying to convert the same script from AS to JS and I've bogged down again.
[1] I collect up a text range ala ID's print dialog (eg, 1-4, 5, 7) and then convert it into a list of document offsets (1, 2, 3, 4, 5, 7) that I can process in a loop. However, when I try and reference pages by those offsets, I am getting back different numbers. The key bits are:
for( j=startOffset; j <=endOffset; ++j ) {
offsetList = offsetList.concat( j );
} // Let's say offsetList becomes 1, 3 (ie, 2nd and 4th pages)
and then later:
for( thisOffset in offsetList ) {
var myPage = pages[ offsetList ]
alert( myPage.name )
} // Returns pages 1 and 2, not 2 and 4
[2] Secondly, a translation question. In Applescript, I can collect a list of every text frame with a certain script label by doing:
set oldFrames to every text frame whose label = "myMarker"
Is there a short-hand equivalent in JS or is something like this the only way:
for( thisFrame in textFrames ) {
if( thisFrame.label == "myMarker" ) {
oldFrames = oldFrames.concat( thisFrame )
}
}
Gads, it is difficult thinking in JS after years of doing AS!
o_O
Thanks in advance,
Eric.
Technical Details
Message-ID:
<59b7582c.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2!feeder.erje.net!news4us.nl!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,bb69fc59ca3f92ae,start X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Eric_@_MCA@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: AS to JS translation questions Message-ID: <59b7582c.-1@webcrossing.la2eafNXanI> Date: Tue, 23 Dec 2008 14:50:29 -0800 Lines: 37 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2!feeder.erje.net!news4us.nl!webcrossing