tag:blogger.com,1999:blog-2909088349875842828.comments2023-01-07T10:31:27.955-05:00Extending FrameMakerDebra Hermanhttp://www.blogger.com/profile/16336331080547778765noreply@blogger.comBlogger40125tag:blogger.com,1999:blog-2909088349875842828.post-49385017426359218942013-12-10T19:24:44.894-05:002013-12-10T19:24:44.894-05:00I have not taken the time to test out this issue s...I have not taken the time to test out this issue so please take that into account in considering my comment.<br /><br />In general, the FDK and ExtendScript allow one to automate actions a user might take manually. Clearly, a user cannot create a group with only one graphic object. On the other hand, with ExtendScript, you must first create a group and then add objects to that group. If for some reason, no objects get added to such a group, the group exists in its anchored frame with no graphics inside it. Similarly, one could add just a single object and stop at that point. Do these actions make sense from a practical view point? Likely not. On the other hand, should they crash FrameMaker. I would say no. If they do, I would consider it a bug. <br /><br />Further, as anonymous implies, it is best to be careful and think about edge cases.Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-1188368392075451012013-11-23T03:54:05.826-05:002013-11-23T03:54:05.826-05:00This comment has been removed by the author.Sinelogixhttps://www.blogger.com/profile/03753447067548332551noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-3339677705095305562013-11-05T12:28:08.243-05:002013-11-05T12:28:08.243-05:00If you have one simple object in the Aframe (eg. a...If you have one simple object in the Aframe (eg. a rectangle), you are going to build a group made of one object ONLY, that is highly dangerous. FrameMaker will badly crash saving the document.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-60942648779872394882013-07-16T15:42:19.710-04:002013-07-16T15:42:19.710-04:00Hi Debra,
Could you please help me demystify the ...Hi Debra,<br /><br />Could you please help me demystify the following xtendscript issue?<br /><br />The following script replaces all chars in text with "y". For some reason, when the script approaches the middle of the document, it makes FM crash. I can't figure out what is causing that problem. It looks like doc.textselection is problematic here, but I don't know how to verify this.<br /><br />Here is the code:<br /><br />var oDoc = app.ActiveDoc;<br /><br />var oRange = oDoc.TextSelection;<br /><br />var oPgf = oRange.beg.obj;<br /><br />var oTLoc1 = new TextLoc;<br /><br />var oTLoc2 = new TextLoc;<br /><br />var oTRange = new TextRange;<br /><br />var sNewTxt;<br /><br /> <br /><br />while ( oPgf.ObjectValid ( ) )<br /><br />{<br /><br /> var oTexts = oPgf.GetText ( -1 );<br /><br /> oTLoc1.obj = oPgf;<br /><br /> oTLoc2.obj = oPgf;<br /><br /> for ( i = 0; i < oTexts.length; i++ ) {<br /><br /> if ( oTexts[i].dataType == Constants.FTI_String ) {<br /><br /> oTLoc1.offset = oTexts[i].offset;<br /><br /> oTLoc2.offset = oTexts[i].offset + oTexts[i].sdata.length;<br /><br /> oTRange.beg = oTLoc1;<br /><br /> oTRange.end = oTLoc2;<br /><br /> oDoc.TextSelection = oTRange;<br /><br /> oDoc.Clear ( 0 );<br /><br /> sNewTxt = oTexts[i].sdata.replace ( /[a-z]/g, 'x' );<br /><br /> sNewTxt = sNewTxt.replace ( /[A-Z]/g, 'X' );<br /><br /> oDoc.AddText ( oTLoc1, sNewTxt );<br /><br /> }<br /><br /> }<br /><br /> oPgf = oPgf.NextPgfInDoc;<br /><br />}<br /><br />Thank you for your advice in advance!<br /><br />Kind regards,<br />RomanAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-79920407706847551122012-09-26T22:35:34.384-04:002012-09-26T22:35:34.384-04:00Thanks for your kind words. I have been neglectful...Thanks for your kind words. I have been neglectful of this blog of late but hope to get back to it soon.<br /><br />DebraDebra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-80687546134518880992012-09-26T20:08:11.146-04:002012-09-26T20:08:11.146-04:00Debra, Awesome Blog, I believe a lot of Frame Deve...Debra, Awesome Blog, I believe a lot of Frame Developer are going to get help from this.<br /><br />Cheers!<br />AnjaneaiAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-38320928249996311212012-09-15T17:15:08.600-04:002012-09-15T17:15:08.600-04:00Hi,
Try saving the file as MIF. You may find you ...Hi,<br /><br />Try saving the file as MIF. You may find you can open it in version 7. Do a manual test before you write any code.<br /><br />Best of luck.<br /><br />DebraDebra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-64386513620668019532012-09-14T09:21:03.234-04:002012-09-14T09:21:03.234-04:00Hello
First of all great work.
Second i need a scr...Hello<br />First of all great work.<br />Second i need a script that open files from a directory and saves them in an older version.I saw you have a code to save a file in an older version but i need to save in 7 and it doesn't work(works fine in 9,8).<br />ThanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-30518544577311428142012-05-10T23:17:19.631-04:002012-05-10T23:17:19.631-04:00Nevermind my last post. I found it. :)
Thanks a l...Nevermind my last post. I found it. :)<br /><br />Thanks a lot.<br /><br />MichaelAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-19922281060825164572012-05-10T23:13:27.855-04:002012-05-10T23:13:27.855-04:00Where can I find the corrected script. I'm try...Where can I find the corrected script. I'm trying to use it for cross-refs as well.<br />Thanks.<br />MichaelAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-22989070309385935922012-05-02T14:56:09.603-04:002012-05-02T14:56:09.603-04:00No error codes, it just didn't add anything wi...No error codes, it just didn't add anything with the AddText when I tried to add to the beginning TextLoc of the element. Also it seemed impossible to select the existing text content within the element.<br /><br />I tried at least the following:<br /><br />var eTr = elem.TextRange<br />doc.TextSelection = eTr<br /><br />Which selected the entire element (not just the text content)<br /><br />And:<br /><br />var eTr = elem.FirstChildElement.TextRange (I figured this would be the -element, at least the same selection produced "null", when I alerted the ElementDef.Name)<br /><br />doc.TextSelection = eTr <br /><br />Which didn't select anythingshokkanennoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-18706044110813208942012-05-02T10:09:53.326-04:002012-05-02T10:09:53.326-04:00It should be possible to add directly to the text ...It should be possible to add directly to the text node if you have the right insertion point. <br /><br />Did you get an error code when you tried your add?Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-89688149221473103772012-05-02T08:30:33.541-04:002012-05-02T08:30:33.541-04:00Hi, thanks for the reply.
I couldn't figure ...Hi, thanks for the reply. <br /><br />I couldn't figure out how to edit the element text content in any smart way, so I finally avoided the problem by creating a similar new element with new content next to the old one (ElementDef.WrapElement()) and then deleting the deprecated one. It's not beautiful but it works :)<br /><br />Editing text node contents should be basic stuff (I think?) so it was a big surprise how difficult it was.shokkanennoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-51533379233133788932012-05-01T12:08:43.269-04:002012-05-01T12:08:43.269-04:00Hello,
I have not had a chance to create an examp...Hello,<br /><br />I have not had a chance to create an example but my quick thought is that when working with elements, you need to use the data structure ElementRange rather than TextRange. Text ranges are applicable only when working with paragraphs.Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-78958309496425992352012-05-01T07:59:59.960-04:002012-05-01T07:59:59.960-04:00Hi!
Thanks for the awesome blog, your articles ar...Hi!<br /><br />Thanks for the awesome blog, your articles are a great ExtendScript information source.<br /><br />I'm working on a script which would change the content of TEXT -nodes and just can't figure out how to do it. I've been trying to select/delete/add -text within a TEXT -node and it just doesn't work - I must be doing something wrong.<br /><br />My approach has been that the element is a child of another element, let's say "elem" so I've been trying to select the text like <br /><br />var childelem = elem.FirstChildElement<br />var tRange = childelem.TextRange<br /><br />... and work on the text - and no luck...shokkanennoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-16238497021244168722012-04-05T11:05:23.372-04:002012-04-05T11:05:23.372-04:00Thanks for your comment.
You can make a selection...Thanks for your comment.<br /><br />You can make a selection. Basically you need to set up the desired ElementRange and then set the current selection to that range. I am working on an example. Look for it in a day or two.Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-53673036131865925602012-04-03T12:11:27.681-04:002012-04-03T12:11:27.681-04:00Hi Debra.
Great blog. Question though: Would you ...Hi Debra.<br /><br />Great blog. Question though: Would you recommend using the Doc.ElementSelection object as a way to ASSIGN a selection (i.e. to actually select)? I realize this is the other way around from using it to describe the user-selected selection but it seems necessary for what I want to do.<br /><br />Thanks,<br /><br />C Chew.Chrishttps://www.blogger.com/profile/15901475079798824919noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-68294935961719253732012-03-27T10:21:19.668-04:002012-03-27T10:21:19.668-04:00You can open the MIF and save as binary using the ...You can open the MIF and save as binary using the 7.0 FDK. But that is a whole different kettle of fish. Best of luck with your project.Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-40918398207539164782012-03-27T08:26:08.921-04:002012-03-27T08:26:08.921-04:00Hi Debra,
First of all, thank you for your respon...Hi Debra,<br /><br />First of all, thank you for your response! I wish it did work. Sometimes, I need to save files as FM7, so the only way to do it is to save them as MIF7.0, which is far from being ideal... <br /><br />In any case, thank you for writing these great articles and for sharing them with other FM users!<br /><br />My best wishes,<br />RomanAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-80628192622956205912012-03-26T16:26:15.799-04:002012-03-26T16:26:15.799-04:00The first thing to check is whether you file opens...The first thing to check is whether you file opens from the UI without any dialog box coming up. If there are font issues, missing graphics or the like. SimpleOpen() won't open it. Also, check FA_errno. That should tell you why it did not open.Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-29374088244961493262012-03-26T15:28:39.488-04:002012-03-26T15:28:39.488-04:00I tried to use this to open a document, but it see...I tried to use this to open a document, but it seems to always return an invalid object. I did this:<br /><br />var FactsFile =File("C:\\table.fm");<br />var doc = SimpleOpen (FactsFile,false) ;<br /><br />But if I check the "doc" to see if its valid, it is not.<br /><br />if (doc.ObjectValid()) {<br /> $.writeln("doc invalid");<br />}<br /><br />Any idea as to what I am doing wrong. I also tried SimpleOpen with true an selected the doc and it still says its invalid.<br /><br />ThanksAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-78775514162089495022012-03-26T10:04:15.356-04:002012-03-26T10:04:15.356-04:00I confess that I did not test these but relied on ...I confess that I did not test these but relied on the documentation.Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-52270515168052465092012-03-26T05:34:25.392-04:002012-03-26T05:34:25.392-04:00Hi Debra,
As far as I know, the FV_SaveFmtBinary6...Hi Debra,<br /><br />As far as I know, the FV_SaveFmtBinary60/70 function does not work in Extendscript. I tried running a script that is supposed to save a file as FM7, but it did nothing. When I changed FV_SaveFmtBinary70 to FV_SaveFmtBinary80, it did work. <br /><br />Kind regards,<br />RomanAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-27906238058369936532012-03-01T15:43:00.821-05:002012-03-01T15:43:00.821-05:00Debra--
While this post is a couple of months old...Debra--<br /><br />While this post is a couple of months old now, I wanted to come back to it and say thank you. This script opened my eyes to the power of recursive functions, and formed the basis of one of my most frequently used functions (building an array of elements)Oliver Johnnoreply@blogger.comtag:blogger.com,1999:blog-2909088349875842828.post-24060089752283693032012-02-10T16:37:36.399-05:002012-02-10T16:37:36.399-05:00Thanks for looking into this.Thanks for looking into this.Debra Hermanhttps://www.blogger.com/profile/16336331080547778765noreply@blogger.com