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

A little change is required in the script, please help.

Return to Member Forum

  • Author
    Posts
    • #69681

      I am using a script named as <Zoom to Width> that I found on web. This script does two jobs

      (1) zoom to a specific percentage

      (2) and center the page horizontally as well vertically at that zoom level.

      I have changed the zoom value to 170% in it. Now the problem is that when script center the page at 170% it shows the middle of the page (horizontal as well as vertical). I need horizontal center but not vertical center of page, so I have to move to the top of page by scrolling or by moving cursor. I want a little change in it that vertically top of the page should appear instead of the middle of page i.e.

      I want 170% zoom + horizontal page center + vertical page top.

      I would appreciate any help. I am on Windows 7 64bit. Here is the script

      //DESCRIPTION: Zooms to the width of currently selected object or the current page. https://www.in-tools.com

      ZoomToWidth();

      function ZoomToWidth(){

      var kAppVersion=parseFloat(app.version);

      try{

      if(File.fs == “Macintosh”){var isMac = true}

      else{var isMac = false}

      if(kAppVersion>=6 && app.generalPreferences.useApplicationFrame){

      var usesApplicationFrame = true;

      }

      else{var usesApplicationFrame = false}

      var sel=app.selection[0];

      var window = app.activeWindow;

      if(! (window instanceof LayoutWindow) ){return}

      var doc = app.documents[0];

      var horizViewPrefs = doc.viewPreferences.horizontalMeasurementUnits;

      doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

      var theWidth = doc.documentPreferences.pageWidth;

      var theHeight = doc.documentPreferences.pageHeight;

      var theSpread = window.activeSpread;

      var pagesLength = theSpread.pages.length;

      if(isMac){

      var windowWidth = window.bounds[3]-window.bounds[1]-35;

      if(usesApplicationFrame){

      window.zoom(ZoomOptions.fitSpread);

      var spreadZoom = window.zoomPercentage;

      windowWidth = (spreadZoom/170)*(theWidth*pagesLength);

      }

      }

      else{

      var windowWidth = window.bounds[3]-window.bounds[1]-50;

      if(usesApplicationFrame){//|| pagesLength>1 || theWidth>theHeight

      window.zoom(ZoomOptions.fitSpread);

      var spreadZoom = window.zoomPercentage;

      windowWidth = (spreadZoom/170)*(theWidth*pagesLength);

      }

      }

      if(sel && (sel.hasOwnProperty(“parentTextFrames”) || sel.hasOwnProperty(“visibleBounds”)) ){

      if(sel.hasOwnProperty(“parentTextFrames”)){

      var textFrame = sel.parentTextFrames[0];

      var frameBounds = textFrame.visibleBounds;

      app.select(sel.parentTextFrames[0]);

      }

      else{frameBounds = sel.visibleBounds}

      theWidth = frameBounds[3]-frameBounds[1];

      }

      else{window.zoom(ZoomOptions.fitPage)}

      window.zoomPercentage = (windowWidth/theWidth)*170;

      doc.viewPreferences.horizontalMeasurementUnits = horizViewPrefs;

      app.select(sel);

      }

      catch(e){}

      }

    • #69687
      Anonymous
      Inactive

      Try This

      try {app.layoutWindows[0].zoomPercentage = 170 } catch (e) {};

Viewing 1 reply thread
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads