Article View: adobe.scripting.indesign
Article #15676Re: Duplicating an inline frame
From: Dave_Saunders
Date: Thu, 20 Nov 2003 16:50
Date: Thu, 20 Nov 2003 16:50
45 lines
2202 bytes
2202 bytes
Here's what I tried:
mySource = app.documents[0].textFrames.item('MainStory').parentStory;
myTarget = app.documents[0].textFrames.item('Target').parentStory.tables.item(0);
curAnt = "";
curClone = "";
curFormat = "";
colName = "";
theLim = mySource.paragraphs.length;
// top loop looks only for Antigens
// needs to skip over continuations
for (i=0;i<theLim; i++){
if (mySource.paragraphs[i].appliedParagraphStyle.name == "inline8pts"){
// potential antigen
mySourcePara = mySource.paragraphs[i];
myAntFrame = mySourcePara.characters[0].textFrames[0];
mySubStory = myAntFrame.parentStory;
myAnt = mySubStory.paragraphs[0].contents;
antLen = myAnt.length;
if (myAnt.charAt(antLen-1) == "\r"){
antLen = antLen - 1;
}
myAnt = myAnt.substring(0,antLen)
if (myAnt != curAnt){
// we have a new antigen, so add a new row to the table
// and get the name into the first column
addAntigen(i);
}
}
}
function addAntigen(i){
// first, add a row to the table
myTarget.rows.add(LocationOptions.atEnd);
myTempFrame = myAntFrame.duplicate();
}
I'm deliberately using global variables, so myAntFrame should be available to the function. I get a message that the item is locked. But it's not and neither is the layer that it's on. The only thing I can think is that it's an inline frame. I guess I was expecting that this would produce a freestanding duplicate on the same page, but now I think about it, that was rather optimistic.
OK, time to use a library.
Dave
Technical Details
Message-ID:
<2cce7fd4.0@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2cce7fd4.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,74b305fb199f34bd,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-11-20 09:08:16 PST From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: Duplicating an inline frame Message-ID: <2cce7fd4.0@webx.la2eafNXanI> Date: Thu, 20 Nov 2003 08:50:32 -0800 References: <2cce7fd4.-1@webx.la2eafNXanI> Lines: 52 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit