ExtendScript Table Object Bug

Rick Quatro rick at rickquatro.com
Sat May 14 08:51:36 PDT 2011


Hi Mike,

 

Very nice workaround. Thanks.

 

Rick

 

From: Michael Pearson [mailto:mt_pearson at hotmail.com] 
Sent: Saturday, May 14, 2011 10:22 AM
To: rick at rickquatro.com; framers at lists.frameusers.com
Subject: RE: ExtendScript Table Object Bug

 

Hi Rick,
 
Yes, I can confirm this bug. ObjectValid() is false when returned via
GetText().
 
A workaround is to replace:    
tbl = textItems[i].obj;

with:
tbl = doc.GetUniqueObject(Constants.FO_Tbl, textItems[i].obj.Unique);

HTH,
Mike Pearson

 
> From: rick at rickquatro.com
> To: framers at lists.frameusers.com
> Subject: ExtendScript Table Object Bug
> Date: Sat, 14 May 2011 09:42:15 -0400
> 
> Hello All,
> 
> I discovered a bug in FrameMaker 10's ExtendScript implementation. If
anyone
> can verify this, please let me know.
> 
> Summary: When you loop through the tables in the document, the
ObjectValid()
> function returns true for each table as expected. However, when you get a
> list of tables using GetText(), the ObjectValid() function returns false
for
> each table. This is a problem, because child objects of the table also
> return false. This is a serious problem because you can't, for example,
loop
> through all of the cells in the table, because ObjectValid() is false for
> each cell.
> 
> Here is an example that illustrates the problem. Open a new FrameMaker
> document and insert 2 or 3 tables in the main flow. Then run the code
below
> and look at the JavaScript Console.
> 
> var doc = app.ActiveDoc;
> 
> // Loop through all of the tables in the document.
> var tbl = doc.FirstTblInDoc;
> while (tbl.ObjectValid()) {
> $.writeln("Loop through doc tables: " + tbl.ObjectValid());
> tbl = tbl.NextTblInDoc;
> } 
> 
> // Get a list of tables in the document's main flow.
> var flow = doc.MainFlowInDoc;
> var textItems = flow.GetText(Constants.FTI_TblAnchor);
> for (var i = 0; i < textItems.len; i += 1) {
> tbl = textItems[i].obj;
> $.writeln("Loop through main flow tables: " + tbl.ObjectValid());
> }
> 
> Rick Quatro
> Carmen Publishing Inc.
> 585-659-8267
> rick at frameexpert.com
> 
> FrameMaker 10 ExtendScript eSeminar
> May 26, 2011, 10:00 AM Pacific
>
http://www.adobe.com/cfusion/event/index.cfm?event=detail&id=1751822&loc=en_
> us



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.frameusers.com/pipermail/framers-frameusers.com/attachments/20110514/a0523b17/attachment.htm>


More information about the framers mailing list