Hello,
I need some help trouble shooting a script.
I am trying to flip the justification for all of a selected set of text frames. However, while most types of flipping work properly, the following does not
if(sel[i].story.textRange.justification == Justification.RIGHT){ sel[i].story.textRange.justification = Justification.LEFT; }
I would expect the justification for items that are Justification.RIGHT to switch to Justification.LEFT, but they remain as Justification.RIGHT
It does not fail, it just does not work as expected.
What is odd is that it seems to work correctly for the three other types of justification I am flipping in the same script. See below for the full script.
Any ideas what is causing this?
try { // Check current document for textFrames. if ( app.documents.length < 1 ) { alert ( "open a document with text objects and select them." ); } else { docRef = app.activeDocument; if ( docRef.textFrames.length < 1 ) { alert ( "Select some text objects." ); } //where text fames are selected swap the jusification else { sel = docRef.selection; var sellen = sel.length; for (var i=0;i<sellen ;i++) { if(sel[i].typename == "TextFrame"){ if(sel[i].story.textRange.justification == Justification.LEFT){ sel[i].story.textRange.justification = Justification.RIGHT; } else if(sel[i].story.textRange.justification == Justification.RIGHT){ sel[i].story.textRange.justification = Justification.LEFT; } else if(sel[i].story.textRange.justification == Justification.FULLJUSTIFYLASTLINELEFT){ sel[i].story.textRange.justification = Justification.FULLJUSTIFYLASTLINERIGHT; } else if(sel[i].story.textRange.justification == Justification.FULLJUSTIFYLASTLINERIGHT){ sel[i].story.textRange.justification = Justification.FULLJUSTIFYLASTLINELEFT; } } } } } } catch (e){ alert("Script Failed!\n"+e); }