Copy link to clipboard
Copied
I need to find non XML text in the indesign file and apply XML tag for those texts.
How to do this via script.
for example : in my file bullet list not having xml structure and the text are inside the xml tag i need to move the bullet inside the xml element
Are you just sure that is a standalone character and not a bullet set with a paragraph style ?
If the latter, this content isn't part of the flow itself but a visual representation of a bullet.
Copy link to clipboard
Copied
Are you just sure that is a standalone character and not a bullet set with a paragraph style ?
If the latter, this content isn't part of the flow itself but a visual representation of a bullet.
Copy link to clipboard
Copied
its character and its not an auto number.
Copy link to clipboard
Copied
Probably not bullet proof but a basis snippet:
var main = function() {
var doc = app.properties.activeDocument, text;
app.findGrepPreferences = null;
app.findGrepPreferences.properties = {
findWhat:"~8\\t"
};
if ( !doc ) return;
var found = doc.findGrep();
var n = found.length;
while ( n-- ) {
text = found
; text.move ( LocationOptions.AFTER, text.parentStory.insertionPoints[text.index+text.length+1] );
}
}
var u;
app.doScript ( "main()",u,u,UndoModes.ENTIRE_SCRIPT, "The Script" );
Copy link to clipboard
Copied
Thank you so much
[text.index+text.length+1]. can you please explain the line.
Copy link to clipboard
Copied
Well as the idea is to move the text right after the tag marker, we want to compute text index, then shift for as many characters the text counts (we could have hard stated that the length is 2 but still better to see things dynamically), then shift once more to jump over the tag marker (+1). Tag markers are actually special characters, they aren't totally ghost objects.