Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Trouble assigning TextFrame to Justification.Left

$
0
0

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);
}

Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>