Hi Bhavna, For this script I am not having any error while saving the book after first run or running the script for second time.
Is this problem occurring for new book file also or just specific to a particular book file? If possible can you share the file with us? I am attaching a bit modified script to make it work on my side. Please see if this is correct. Thanks, Pawan Keshari FM Engineering I'm using Adobe Send. You can view "Source1.jsx" at: https://files.acrobat.com/a/preview/5540cdda-71a3-40cc-b455-0b0cdde1eca3 From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Bhavna Raghwani Sent: Monday, January 26, 2015 1:51 PM To: [email protected]<mailto:[email protected]> Subject: FrameMaker becomes unresponsive while running the script for the 2nd time Hi Framers,\ I am trying to run to traverse through the paragraph tags in the book files and check for a condition applied on them using the following script: var openedBook = app.ActiveBook //openBookFiles(openedBook) //savePdf(openedBook,bookFile + ".pdf")\ var arr_ChapterIds=new Array(); var bookChapter=openedBook.FirstComponentInBook var chapterId = bookChapter.id var pgfText = null; var msg = null; var totalPgfs = 0; /* Calculating the number of chapters in the book */ while(chapterId) { var chapterId = bookChapter.id var chapterName = bookChapter.Name chapterId=openFile(chapterName) if(chapterId!=0 && chapterId!="") { arr_ChapterIds.push(chapterId) } bookChapter = bookChapter.NextComponentInBook; chapterId = bookChapter.id; } // Err(arr_ChapterIds.length); /*Processing the tasks for each chapter*/ for(i=0; i<arr_ChapterIds.length;i++) { var objcid=arr_ChapterIds[i]; cid=objcid.id<http://objcid.id>; cname=objcid.Name; /* Traversing through the paragraphs*/ var pgf = objcid.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf; while(pgf.ObjectValid() == true) { totalPgfs = totalPgfs + 1; var formatName = pgf.Name; var textRange = new TextRange(); textRange.beg.obj = pgf; textRange.beg.offset = 0; textRange.end.obj = pgf; textRange.end.offset = Constants.FV_OBJ_END_OFFSET; var textItems = objcid.GetTextForRange(textRange, Constants.FTI_String); if(textItems.length > 0) { pgfText = textItems[0].sdata; if(pgfText.length > 50) pgfText = pgfText.substring(0, 50); } else pgfText = "(No text!)"; if(pgf.Name=="Related_Topics" && textItems.length>0) { Err ("Related Topics tag is applied for:"+pgfText+"\n\n");} pgf = pgf.NextPgfInFlow; } var getChangeBarVal=objcid.AutoChangeBars; if (getChangeBarVal==1) Err("Change Bars are on for:"+cname+"\n\n"); else Err("Change Bars are off for:"+cname+"\n\n"); } function openFile(chapterName) { openProp = GetOpenDefaultParams() retParm = new PropVals() fileOpen=Open(chapterName,openProp,retParm) return fileOpen; } This script runs fine for the first time and displays the result on the FrameMaker console. However, here are the issues that I am facing: * After the execution is finished for the first time and as I try to save the book file, FrameMaker displays an error message * If I run the script the next time, FrameMaker becomes completely unresponsive needing a forced shutdown There are many paragraph tags that the script traverses through and probably stores in a variable. Therefore, I think it may be a memory issue. Can you please go through the script and help me in debugging the issue. Thanks. Regards, Bhavna
_______________________________________________ You are currently subscribed to framers as [email protected]. Send list messages to [email protected]. To unsubscribe send a blank email to [email protected] or visit http://lists.frameusers.com/mailman/options/framers/archive%40mail-archive.com Send administrative questions to [email protected]. Visit http://www.frameusers.com/ for more resources and info.
