0 Replies Latest reply on Nov 15, 2010 9:36 AM by MT.Freelance

    JSX in CS5 assistance request

    MT.Freelance Level 4

      I have a javascript (coded by Dave Saunders) that has been of great benefit to me over the past few years. It has worked without changes with InDesign CS2, CS3, and CS4 (Mac and Windows). This helpful tool allows me to position an InDesign window where I want it on my screen. Next the script is run to create a default data file. Finally, when the script is run again, it repositions the active window to match the location of the window defined in the default data file.

       

      This morning, it will not run in InDesign CS5 (7.0.3). It merely beeps at me when I invoke the script via the script panel or the assigned KB shortcut.

      The script worked with CS5 pre-update (7.0.0).

      The script stil works with CS4 (6.0.6) on the same system.

       

      System:

      Mac OS 10.6.4

      InDesign CS5 (7.0.3)

       

      Will any script guru out there be able to assist me with making this work again in CS5?

       

      // JavaScript Document
      //DESCRIPTION: Resets active window size or uses front window to set default size.

       

      // Check for WindowDefault.txt; if present use it to set front window
      // if not, use front window to set it after checking with user.

       

      myPath = app.activeScript;
      myParts = myPath.toString().split("/");
      myParts[(myParts.length - 1)] = "WindowDefault.txt";
      myNewPath = myParts.join("/");

       

      mySettingsFile = File(myNewPath);

       

      // Before proceeding, check that there is a front window
      // If not, offer user the chance to delete the current settings
      if (app.windows.length < 1) {
      if (confirm("No window is open; would you like to delete the settings file?")) {
        // User said yes; check that it exists
        if(mySettingsFile.exists) {
         mySettingsFile.remove();
        }
      }
      } else {

       

      if (mySettingsFile.open("r")) {

       

      savedBounds = mySettingsFile.read();
        mySettingsFile.close();

       

      myBounds = savedBounds.split(",");
        for (i = 0; i<myBounds.length; i++) {
         myBounds[i] = Number(myBounds[i]);
        }
        app.windows[0].bounds = myBounds;
      } else {
        if (confirm("Settings file is missing. Use current front window to set default?")) {
         // User said: go to it.
         new File(mySettingsFile);
         mySettingsFile.open("w");
         mySettingsFile.write(app.windows[0].bounds);
         mySettingsFile.close();
        }
      }
      }

       

       

      Thanks!

       

      -mt