1 Reply Latest reply on Dec 15, 2010 2:37 PM by flavioflavio

    change active window using script?

    flavioflavio

      Hi there,

       

      I'm trying to find an answer for this for a few days now. I'm sorry, but I'm quite a beginner with scripts.

       

      I have to work with many texts that come from a content manager (Atex). The content manager, however, only opens these text files in InCopy's Story View - usually, they are easier to work using the Layout View. My aim is to create a simple script that:

       

      - changes the view from story to layout, and

      - applies a zoom factor to the text so that it can be seen more closely.

       

      The second part is fine. From what I've seen at the forums, both alternatives work nicely:

       

      app.activeWindow.zoomPercentage = 230;

       

      or

       

      app.activeDocument.windows[0].zoomPercentage = 230;

       

       

      Now is there a way to solve the first part? It would help me enormously!

       

      thanks!

        • 1. Re: change active window using script?
          flavioflavio Level 1

          Oh, I figured out!

           

          By using this:

           

          var myMenuActionNames = app.menuActions.everyItem().name;

          //Open a new text file.

          var myTextFile = File.saveDialog("Save Menu Action Names As", undefined);

          //If the user clicked the Cancel button, the result is null.

          if(myTextFile != null){

          //Open the file with write access.

          myTextFile.open("w");

          for(var myCounter = 0; myCounter < myMenuActionNames.length; myCounter++){

          myTextFile.writeln(myMenuActionNames[myCounter]);

          }

          myTextFile.close();

          }

           

          I saw the list of possible actions and it led me to:

           

          app.menuActions.itemByName("Layout View").invoke();

          app.activeWindow.zoomPercentage = 230;

           

          I even managed to create new shortcuts for the content manager!

           

          cheers!