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

Adding a Processing Instruction to the beginning of every text frame

New Here ,
Sep 10, 2009 Sep 10, 2009

Hi,

I need to place a processing instruction at the beginning of every text frame. The instruction itself will contain the page number.

I already worked out a script that will bring the instruction into the document as text, but since that causes page reflow, I would rather it come in as an xml marker. (Just as an aside, the script I mentioned goes from the end of the file to the front, to prevent reflow from being an issue on page breaks.)

What is the best way to do that? I do see how to create the instruction itself: but how do I insert it in place?

Something like this?

var myXMLProcessingInstruction = myRootXMLElement.xmlInstructions.add("blah", "blah");

TextList[0].insertionPoints.item(0).contents=myXMLProcessingInstruction;
Thanks in advance.

TOPICS
Scripting
886
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 ,
Jan 17, 2018 Jan 17, 2018

By Using the below script you can insert tag of start of each and every paragrapgh 

var mydoc = app.activeDocument;

        var myPg = mydoc.pages;
pages[0].textFrames[0].words[0].insertionPoints[0].associatedXMLElements[0].xmlInstructions.add("pageStart", "TextFrameStart");

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 ,
Jan 18, 2018 Jan 18, 2018
LATEST

A different idea would be to add a label with the instructions to a text frame.

textFrame.label = "Processing instructions here."

Using this you would even see the label's contents in the UI when using the Scriptslabel Panel.

The contents of the label could even be a string of ExtendScript code you could execute by using doScript() or eval().

var instructions = textFrame.label;

eval( instructions );

Regards,
Uwe

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