Copy link to clipboard
Copied
Hi experts,
My goal is add a tags in anchor text, here is orginal:
here is my goal:
Thanks
regard
John
Copy link to clipboard
Copied
So what did you try ?
Copy link to clipboard
Copied
Hi Loic,
I got this script:
app.findObjectPreferences = NothingEnum.nothing;
app.changeObjectPreferences = NothingEnum.nothing;
app.findObjectPreferences.anchoredPosition = AnchorPosition.ANCHORED;
var t =myDocument.findObject();
for(var i=0 ; i < t.length ; i++)
{
var tf=t;
if(tf.parent.constructor instanceof Character)
{
tf.texts.everyItem().move(LocationOptions.BEFORE, tf.parent);
tf.parent.contents = "</sn1>\r";
}
}
app.findGrepPreferences =
app.changeGrepPreferences = null
app.findGrepPreferences.findWhat = "^(.+)</sn1>";
app.changeGrepPreferences.changeTo = "<sn1>$1</sn1>";
app.changeGrep();
for get anchor text into main story, and add tags
but How can I add the tags first will then get the anchor into main story?
thanks
Regard
John
Copy link to clipboard
Copied
Well as far as I understand you should reach the insertionPoint you are interested in and add a textFrame to this object. Then you can add contents to the anchored text frame.
Copy link to clipboard
Copied
Hi John,
did you analyze the script you are showing in answer #2 ?
Did you run it step by step, line by line, from the ESTK ( ExtendScript Toolkit )?
There is a step-by-step mode.
And you can set break points in the code and when a break point is reached you can inspect your variables in the JavaScript Console of the ESTK. Just write them into the Console window and press enter.
So you can find out what the variable tf really holds at that time.
Read the JavaScript Tools Guide for how to use the ESTK..
You can find that under "Help" in the ESTK.
Regards,
Uwe
Copy link to clipboard
Copied
Thank you Loic
but How can I get insertPoint in each ANCHORD text frame?
Regard
John
Copy link to clipboard
Copied
well insertionPoint is a child of the collection of insertionPoints that belongs to the textframe reference.
So that would be tf.insertionPoints[0];
Copy link to clipboard
Copied
Hi Loic
I change it like this:
app.findObjectPreferences = NothingEnum.nothing;
app.changeObjectPreferences = NothingEnum.nothing;
app.findObjectPreferences.anchoredPosition = AnchorPosition.ANCHORED;
var t =myDocument.findObject();
for(var i=0 ; i < t.length ; i++)
{
var tf=t;
tf.insertionPoints[0].contents = "<sn1>";
tf.insertionPoints[-1].contents = "</sn1>";
if(tf.parent.constructor instanceof Character)
{
tf.texts.everyItem().move(LocationOptions.BEFORE, tf.parent);
tf.parent.contents = "\r";
}
}
but error.
Coule you please show me how?
Regard
John
Copy link to clipboard
Copied
John or whatever your real name is:
First, a lot of topics this week. Second, those posts are realy annoying!
So, if you have a real problem, provide idml-files before/after. What should we do with your scrumbled screenshots? You know, I told you that from time to time.
If you provide code, this code should be runable. In your example 'myDocumet' is not declared.
Your code assumes, that you want to move everything from your anchored textframe in the normal textflow, but that is not what the second screen shows.
So:
1. Provide examples
2. Make a detailed list with steps, that must be scripted
3. Think about it and show your executable script trial
Kai
Copy link to clipboard
Copied
thank you Uwe,
I will try.
thank you so much.
regard
John
Find more inspiration, events, and resources on the new Adobe Community
Explore Now