Hi Friends,
How to get the Before and After hyphenation words in indesign scripting.
Example:AAAA-BBBBj(Automaticaly hyphenated)
How to get AAA & BBBB and save in separate variables.
Please give idea.
uh..
i did something like this a while ago, but i can't find the code.
the problem is that the automated hypen does not apear in the text variable.
so.. (assuming that AAAABBBB is stored in myVariable)
myVariable.lines[0] will get the line, ending with the first part of the word,and
myVariable.lines[1].. you get the ideea.
unfortunatly using
myVariable.lines[0].words[-1] will give you the entire word (AAAABBBB) so the trick i used was to insert a space at the end of the line like:
myVariable.lines[0].insertionPoints[-1].contents=" "; then get the first and last part of the word using
.lines[0].words[-1] and .lines[1].words[0] then remove the added space (.lines[0].characters[-1].remove())
ps. it's just a guide to get you started, in the actual code you will have to be a bit more careful.
Hi Friend,
Use the below code to select the first part and second part seperately.
| Javascript Code |
|---|
var myTxt = app.selection[0]; var myChar2 = app.selection[0].lines[1].characters[0]; myTxt.characters[0].select(); alert("First part selected"); myChar2.select(); myTxt.characters[-1].select(1633969202); alert("Second part selected"); |
Regards,
Ramkumar .P
North America
Europe, Middle East and Africa
Asia Pacific