Copy link to clipboard
Copied
Dear Friends,
Now i am doing one project, that project requirement some of the words doing inline anchor box in the runnng paragraph (please see the screen shot). My requirement is remove the anchor box and same anchor box text place in the same place.
I using "Peter Kahrel" script, but its not run the script, its showing error (Please see the screen shot), kindly advice.
---------------------------
(function () {
var stories = app.documents[0].stories.everyItem().getElements();
var ix;
for (var i = stories.length-1; i >= 0; i--) {
while (stories.textFrames.length > 0) {
ix = stories.textFrames[-1].parent.index;
stories.textFrames[-1].texts[0].move (LocationOptions.AFTER, stories.insertionPoints[ix]);
stories.textFrames[-1].locked = false;
stories.textFrames[-1].remove();
}
}
}());
------------------
 
 Thanks
kanagakumar.k
Replace
stories.textFrames
with
stories[i].textFrames
everywhere (five times).
Corrected script [Thanks Peter] below:
(function () {
var stories = app.documents[0].stories.everyItem().getElements();
var ix;
for (var i = stories.length-1; i >= 0; i--) {
while (stories[i].textFrames.length > 0) {
ix = stories[i].textFrames[-1].parent.index;
stories[i].textFrames[-1].texts[0].move (LocationOptions.AFTER, stories[i].insertionPoints[ix]);
stories[i].textFrames[-1].locked = false;
stories[i].textFrames[-1].remove();
}
}
}());
Copy link to clipboard
Copied
Replace
stories.textFrames
with
stories[i].textFrames
everywhere (five times).
Copy link to clipboard
Copied
We also need to replace this:
stories.insertionPoints[ix]);
by this:
stories[i].insertionPoints[ix]);
Copy link to clipboard
Copied
Corrected script [Thanks Peter] below:
(function () {
var stories = app.documents[0].stories.everyItem().getElements();
var ix;
for (var i = stories.length-1; i >= 0; i--) {
while (stories[i].textFrames.length > 0) {
ix = stories[i].textFrames[-1].parent.index;
stories[i].textFrames[-1].texts[0].move (LocationOptions.AFTER, stories[i].insertionPoints[ix]);
stories[i].textFrames[-1].locked = false;
stories[i].textFrames[-1].remove();
}
}
}());
Copy link to clipboard
Copied
Thank you "Peter Kahrel" and "Jean-Claude Tremblay"
Copy link to clipboard
Copied
Hi @kanagakumar ,
just a note:
Because the iterators [i] are missing several times in the code you posted in your inital post, you may found the script code somewhere in the forum here. A typical forum bug with old code! Very likely this code was damaged when the old thread was moved from the old InDesign Scripting forum to this new InDesign forum here in October 2019.
So be careful to copy old code pre October 2019 here from forum posts.
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
Dear Laubender,
Noted "Laubender". Thank you for your valuable guidance. Your guidance is precious mine.
Thanks
kanagakumar.k