Skip to main content
April 19, 2009
Question

Help me Please..? How to change X & Y co-ordinate and height & width selected content...?

  • April 19, 2009
  • 2 replies
  • 1164 views

Hi Everyone!

          This is Vijay.I'm new baby to Indesign Script.In my office i took one task for indesign, that's i link one image to picture box that image jump from original position.so i copy that picture box and paste in place to new layer and now link the Eps to that box. againg jump that image. actually (manualy) i copy height,width , center  X and Y coordinates from old picture box image and Paste in to newly link image. then link image was perfectly sit in position. any one do for Script or any one help me how to do this..Script.

Thanks in Advance

-yajiv

Sample for ur clarification....

1.jpg

2.jpg

This topic has been closed for replies.

2 replies

Participant
April 20, 2009

Hi Dave!

               Thanks for Quick replay. your script was not working. i think, some mistake in my scripts. i cant find out width and height, some link image has been rotated vertically. the problem is based on rotation of link image.can you solve that problem..?

Thanks in Advance.

-yajiv

Inspiring
April 20, 2009

I'm sure I could solve it, but I'd either have to learn about the transformation stuff or dig out my geometry skills from distant days.

You have to work with the properties of the objects to get at what you need.

My script was not intended to just work -- it was an illustration of how to set the width and height but of unrotated elements.

Sorry, I don't have the time to research this further right now.

Dave

Participant
April 21, 2009

Hi Dave.

               Thanks for ur Replay. No problem yaar. i try to finish that script. Thanks Dude.

-yajiv

Inspiring
April 19, 2009

Which scripting language are you familiar with? How far have you gotten with your script?

Dave

April 20, 2009

hi Dave!

               Thanks for Quick Reply. Actually i know very well in Java script. may be i finish that script with in 2 weeks. i try to work but i can't that why i post..!

can you tell any idea to solve that problem.now the problem is i can't change height and width. thanks in Advance.

-yajiv

my script is..

    var i,j;
    var mysel=app.activeDocument.selection;   
    var myDoc = app.activeDocument;
    if (app.documents.length > 0){
        if (mysel.length > 0) {

            //app.copy();
            var myObj1 = app.selection[0];
            var myObj2 = app.selection[1];
           
            var vb = myObj1.visibleBounds;
            var vb1 = myObj2.visibleBounds;
           
            var myWidth = vb[3]-vb[1];
            var myHeight = vb[2]-vb[0];

            var myWidth1 = vb1[3]-vb1[1];
            var myHeight1 = vb1[2]-vb1[0];

           
            var X=(vb[3]+vb[1])/2;
            var Y=(vb[2]+vb[0])/2;

            //myObj1.deselect();
           
           
            myObj.visibleBounds=myObj1.visibleBounds;

            alert(myObj.visibleBounds);

            alert("MyObjWidth = "+myWidth+"\n"+"MyObjHeight = "+ myHeight);
             alert("MyObjWidth1 = "+myWidth1+"\n"+"MyObjHeight1="+ myHeight1);
             alert(myObj.visibleBounds);        

        }
        else {
            alert("Nothing is selected. Please select an object and try again.");

               }
       }
    else {
        alert("No InDesign documents are open. Please open a document and try again.");
        }

Inspiring
April 20, 2009

To change the height, calculate the new visibleBounds values for the objects and then apply those values. Along these lines:

myBounds = myObj.visibleBounds;

myBounds[3] = myBounds[1] + newWidth;

myBounds[2] = myBounds[0] + newHeight;

myObj.visibleBounds = myBounds;

Dave