8 Replies Latest reply on Aug 10, 2018 4:20 AM by Laubender

    Help with InDesign script to import and resize graphic

    larryp22136904 Level 1

      Hello:

      I'm new to scripting and could use some help with a script for importing a graphic, and then resizing the graphic to a specific size and adjusting the graphic placement.

       

      Here is what I've got so far.

      Sorry if it is primitive, but I not sure how to go forward.

       

      The script "does" prompt to import the graphic, say, a stock report or comic graphic, and once selected, it imports it, but then gives an error message.

      I wold like to resize the graphic to the sizes listed, fit content to frame, and position it with x, y coordinates.

       

      Thanks for any help you can offer.

       

      var myDocument = app.activeDocument, 

      //Display a standard open file dialog box to select a raphic file. var myGraphicFile = File.openDialog("Choose a graphic file"); //If a graphic file was selected, and if you didn't press Cancel, //place the graphic file on the page. if((myGraphicFile != "")&&(myGraphicFile != null)){

      myGraphicFile = File.openDialog("Choose a graphic file");

      var myGraphic = myDocument.pages.item(0).place(myGraphicFile);

      var g=app.activeDocument.allGraphics; 

        myGraphicFrame.geometricBounds = ["6p", "2.4p", "129p", "63.4p"];