2 Replies Latest reply on Feb 5, 2014 9:14 AM by gisteppen

    How to get the flags for GetText()?




      The Fm 10 Scripting Guide seems to say that the flags parameter for GetText() is a bitmask, and I should OR constants to get different kinds of text items and so forth. Is this really true or is there some simpler way to tell GetText() what text items I need? Or do I need to brush up my rusty bitwise OR skills? Or did the tech writer just cut and paste form the FDK Reference?



        • 1. Re: How to get the flags for GetText()?
          frameexpert Level 4

          I just use a pipe symbol to OR in the constants I need. For example, this one gets paragraph begins and table anchors in a single text list:


          var textList = doc.MainFlowInDoc.GetText(Constants.FTI_PgfBegin | Constants.FTI_TblAnchor);


          Please let me know if you have any questions or comments. --Rick

          1 person found this helpful
          • 2. Re: How to get the flags for GetText()?
            gisteppen Level 1

            Thanks for that simple answer Rick, I appreciate it. I knew it was simpler than the docs presented it.


            Assuming that ExtendScript technical writers monitor this forum (and for anyone else with a confusion over this), here are my suggestions to clarify the FrameMaker 10 Scripting Guide, p.452, section on GetText() for the Cell object (and also the Cell.GetText() page in the ExtendScript Object Model docs):


            • Give a simple example of the use of the constants with the pipe (OR) character, like Rick's example above. That would have saved a lot of time.
            • Don't mention the DeallocateTextItems() method, you don't have to deallocate memory in ExtendScript or JavaScript. Also DeallocateTextItems() does not exist. This was apparently copied over from the FDK manual.
            • Don't mention bitwise ORing unless you clearly explain that it simply means to separate constants with the pipe ( | ) character. It implied to me that I was going to have to have to get into the JavaScript bitwise operators, which is not correct. The concept of bitwise OR might be useful for a C programmer using the FDK, but it is probably counterproductive for nearly everyone who uses ExtendScript.
            • Instead of presenting the table of constants as the values of TextItem.dataType, present them as the constants you need to give as the flags parameter for GetText(). Now that I know what that table is, it is very useful. But when it is presented as the values of TextItem.dataType with no further explanation, I disregarded it completely because it seemed like something I didn't need to know.


            Thanks for listening.