Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to get the flags for GetText()?

New Here ,
Feb 04, 2014 Feb 04, 2014

Hello,

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?

Thanks

TOPICS
Scripting
821
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 04, 2014 Feb 04, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 05, 2014 Feb 05, 2014
LATEST

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.

Mark

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines