Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Help with ME specific option – story direction

Return to Member Forum

  • Author
    Posts
    • #62186
      Ymg2000
      Member

      I'm trying to write a Java script to change the selected story to RTL (story options, not paragraph direction).

      I'm new to scripting. I came up with the following which gives me an error. Can any scripting expert point me in the right direction?

      Here is the JS:

      var myTextFrame app.activeDocument.activePage.activeTextFrame

      with(myTextFrame){

      StoryPreferences.parentStory.storyPreferences.storyDirection =

      StoryDirectionOptions.RightToLeftDirection;

      }

      End With

    • #62188
      Ymg2000
      Member

      I figured it out. It turns out I didn't know how to tell the script which object to apply it to (the var in the first line).

      Here's the correct script, in case anyone is interested:

      myTextFrame = app.selection[0];

      with(myTextFrame){

      parentStory.storyPreferences.storyDirection =

      StoryDirectionOptions.rightToLeftDirection;

      }

    • #62497

      Here your solution:

      var myDocument = app.documents.item(0);

      var myPage = myDocument.pages.item(0);

      var myTextFrame = myPage.textFrames.item(0);

      var myTextObject = myTextFrame.parentStory.characters.item(0);

      main ();

      function main ()

      {

      try

      {

      if (app.selection[0].parentStory.storyPreferences.storyDirection == StoryDirectionOptions.rightToLeftDirection)

      app.selection[0].parentStory.storyPreferences.storyDirection = StoryDirectionOptions.leftToRightDirection

      else

      app.selection[0].parentStory.storyPreferences.storyDirection = StoryDirectionOptions.rightToLeftDirection

      }

      catch (_){}

      }

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
Forum Ads