[JS IDCS5] changing geometricBounds

When I change the geometricBounds of a frame (myFrame.geometricBounds = [0, 0, 100, 100]), the graphic within that frame is moving. I want to change these bounds, but the graphic inside has to stay at his position (x = 0, y = 0).
Regards, Sjoerd

Solution:
save the geometricBounds of the frame
resize Frame
declare values of the saved geometricBounds
move the inline graphic backwards with the declared values
Example:
var myBounds = mySelection[i].geometricBounds;
mySelection[i].geometricBounds = ["0mm", "0mm", "130mm", "130mm"];
var myX = myBounds[0];
var myY = myBounds[1];
mySelection[i].graphics[0].move(undefined, [-myY, -myX]);
Sjoerd

Similar Messages

  • JS CS3 Change geometricBounds

    Hi
    When I run:
    app.selection[0].geometricBounds = [0,0,10,10];
    everything works as expected.
    I only want to change the width so I tried:
    app.selection[0].geometricBounds[3] += 10;
    or
    app.selection[0].geometricBounds[3] = app.selection[0].geometricBounds[3] + 10;
    nothing changes and no error message appears.
    I solved it in the following clumsy way eventually:
    a = app.selection[0].geometricBounds[0];
    b = app.selection[0].geometricBounds[1];
    c = app.selection[0].geometricBounds[2];
    d = app.selection[0].geometricBounds[3] + 10;
    app.selection[0].geometricBounds = [a,b,c,d];
    So it finally kind of works but it leaves me scratching my head. Is this really the way to do it?
    Thanks for clarification
    weller

    I would do it this way:
    myBounds = app.selection[0].geometricBounds;
    myBounds[3] = myBounds[3] + 10;
    app.selection[0].geometricBounds = myBounds;
    The point is that because the property is an array, you must set it with an array -- if you try to manipulate a member of the array, what happens is that ExtendScript creates a temporary version of the array, manipulates that and it is left hanging out there with no effect.
    Dave

  • [IDCS5] Change to inline make a strange behavior

    Hi,
    I am writing a ChangeToInline function with kChangeILGCmdBoss command, exactly like SnpManipulateInline::ChangeToInline.
    But, the command has a strange behavior. Item is anchored inline, but a copy of it rest on the page.
    This copy is like a phantom item. I can't select it and I can't delete it, it's not in a locked layer, but appears on the page.
    Can anyone tell me how could I delete it ?
    Thanks.

    Let me explain a little more my problem.
    Just modify the SnpManipulateInline::CreateFrame function like this :
    #include "FileUtils.h"
    #include "ISpreadList.h"
    #include "ISpread.h"
    ErrorCode SnpManipulateInline::CreateFrame(IDataBase* database, UIDRef& newFrameUIDRef)
    // You can make any type of frame into an inline. Here we make a new graphic frame.
    PMRect bounds(0, 0, 100, 100);
    SDKLayoutHelper layoutHelper;
    IDFile imageFile;
    FileUtils::PMStringToIDFile("c:\\tmp\\colorbars.tif",imageFile);
    // Get reference to spread layer
    InterfacePtr<ISpreadList> iSpreadList(database,database->GetRootUID(),UseDefaultIID());
    InterfacePtr<ISpread> iSpread(database,(iSpreadList->GetNthSpreadUID(0)),UseDefaultIID());
    SDKLayoutHelper helper;
    UIDRef spreadLayerRef=helper.GetSpreadLayerRef(::GetUIDRef(iSpread));
    // Place image
    newFrameUIDRef=layoutHelper.PlaceFileInFrame(imageFile,spreadLayerRef,bounds, K2::kSuppressUI);
    //newFrameUIDRef = layoutHelper.CreateRectangleFrame(UIDRef(database, kInvalidUID), bounds);
    if (newFrameUIDRef)
         return kSuccess;
    else
         return kFailure;
    Then try it in SnippetRunner. This is the result :
    and you see what I means.

  • How do I change position of video floating window in IDCS5 PDF export?

    I have created an interactive document in InDesign CS5 (for Mac) that includes some movies. The page size is 1280 x 800 and the H264.mov files are 960 x 540 and 800x600. I place the movie in the center of the page at 100% size (without resizing either the movie object or the frame). The poster is set to None to keep it blank. In the PDF options, the Play Video in Floating Window box is checked, with the size set to 1x and the Position is set to Center by default but it is grayed out, with no option to change it.
    When I export the document to PDF (Interactive) with both View and Layout set to Default and Buttons and Media set to Include All, the resulting PDF file opens the movie window in the upper right corner of the PDF document window. It does this whether viewing in Acrobat X Pro (10.1.2) or Acrobat Reader (9.5.0). I've tried opening the file on other computers and have the same issue. I've also created the same document in IDCS5.5 with the same outcome.
    I'd like the movie to open in the center of the PDF document window. I've made other documents where it does this, but for the life of me can't figure out what I'm doing differently to cause the floating movie window to open in the upper right corner of the PDF document.
    Any insight you could provide would be very helpful.
    Thanks,
    John

    Thanks for your reply, Steve. I, too, believe there is a bug, but it's not in InDesign CS5, as I mentioned in my post, I was able to replicate the problem by opening the file in CS5.5 and exporting it to an interactive PDF. The movie again opens in the upper right corner.
    However, if I create a NEW page in the document and place the same movie. it opens in the PDF reader centered in the page. I guess I could recreate the document if this is the only fix, but I thought that I may be doing something wrong, which apparently is not the case.
    "Computers often do what you want them to, but they ALWAYS do what you tell them to."   —anonymous
    "If you have placed the video in InDesign in it's own frame, should you not leave this box unchecked?"
    Rik, I didn't actually place the movie into a new frame. What I meant to say was that once the movie was placed into the document, I did not resize it. I found that if I don't have the PDF viewer open the movie in a flaoting window, the movie quality suffers if the PDF viewer opens in a larger size than the original InDesign page size (which can happen depending on how the user's PDF viewer is configured). However, the movie plays and views perfectly if it is in a floating window.
    jh

  • IDCS5 Win - changing mouse cursor

    At times I have code that processes a lot of data in ways that are not amenable to progress bars (for example, saving a single, large file to disk).  During those times I would like to change the cursor from its standard arrow to another standard such as an hourglass.  I see lots of general documentation on changing cursors that are specially made, but nothing that describes the process for changing from one standard cursor shape to another.  Nor is there any sample code/snippets that demonstrate the procedure, as far as I could find.  Does anyone have a suggestion where to look or what boss to use to change a mouse cursor from one icon to another?
    TIA!
    John

    I took a quick look at the header file and it all seems waay too simple.  Are you sure you're talking InDesign here? (grin).
    Thanks Dirk.  This is what I was looking for.
    R,
    John

  • CS3 JS create textFrame with label then change content at a later stage.

    Is it possible to select a textframe by label?
    Here is a simple script which creates 2 text boxes labeled JSLabel and JSLabel2.
    var myDocument = app.documents.add();
    var myTextFrame = myDocument.pages.item(0).textFrames.add();
    myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];
    myTextFrame.contents = "Hello World!";
    myTextFrame.label = "JSLabel";
    var myTextFrame = myDocument.pages.item(0).textFrames.add();
    myTextFrame.geometricBounds = ["8p", "8p", "24p", "24p"];
    myTextFrame.contents = "Hello World Again";
    myTextFrame.label = "JSLabel2";
    Here is a script you can run at a later stage to change the content of JSLabel textframe.
    if (app.activeDocument.textFrames[1].label == "JSLabel"){
    var mySelect = app.activeDocument.textFrames[1];
    app.select (mySelect);
    mySelect.contents = "Text has been changed.";
    Rather than using if (app.activeDocument.textFrames[1].label == "JSLabel") can I just select the textframe labeled JSLbel and change the content?

    Just bear in mind that if you have multiple frames with the same label, they'll all be affected if you set the content.
    Dave

  • [CS4 JS] geometricBounds error

    Hi all,
    Some times myBounds[0] reports 2.27373675443232e-13 instead of 0 as exprected. If I check in InDesign it infact 0.
    Has anyone seen this before?
    Script:
    var myRectangle = app.documents.item(0).textFrames.itemByID(ItemID);
    var myBounds = myRectangle.geometricBounds;
    if (myBounds[0] == 0) {
         // Do stuff
    René

    It seems that placing an object with InDesign in coordinates y:0 doesn't necessary means that it in fact is in y:0. It might be  y:0.000000003 which isn't 0. ;o)
    I changed my script ho have a small tolerance of a point, that makes it work just fine.
    molsted

  • [JS CS3] Modify geometricBounds of Inline Frames in Overset Text

    Hello,
    I have the following setting:
    I recieve a XML file , which contains <image href="..."> tags. InDesign automatically inserts the correct images as an inline frame.
    The layout column are too small for the large images, so when placing the XML into the layout, the whole content is in the overset.
    Inline frames in the overset do not have any geometricBounds. Can I modify width & height of frames in overset text? And how do I do that?
    Thanks
    Tobias

    Thanks Robin!
    I helped myself with the following:
    with(myElement){
         // get img objects
         var theImage = myElement.xmlContent;
         var theImageFrame = theImage.parent;
         theImageFrame.appliedObjectStyle = myDocument.objectStyles.item("Img_free");
    The objectStyle "Img_free" sets the image frame from "inline" to "anchored frame". So the size of the image doesn't matter any more because its outside ("free") of the text. So everything flows into visibility and I can change whatever I want. (Yes, I must not do this with a object style, but it felt right to do so.)
    It's basically a similar way to your description. But I had hoped that there would be a somewhat "cleaner" way to do that. In my eyes it is more a workaround ...
    Any further suggestions?
    (How do people scripting InDesign Server do such things?)
    Thanks
    Tobias

  • How to change label color in LabelGraphics script?

    I am using ID CS4 and running the LabelGraphics script to label several images in a large document. When I run thre script, the box with the file name is transparent with black type. I would like the box to be white with black type. Is there any way to edit the script that will enable this? It would be great if there was an "object style" in addition to the "paragraph style" in the run script pop-up window. Anyone?

    Hi hylet,
    Here's how to change the LabelGraphics.jsx script itself to add an object style option:
    1. Look for the line:
    var myStyleNames = myGetParagraphStyleNames();
    And add this line before or after it:
    var myObjectStyleNames = app.documents.item(0).objectStyles.everyItem().name;
    2. Look for the lines:
    //Style to apply
    with(dialogRows.add()){
         with(dialogColumns.add()){
              staticTexts.add({staticLabel:"Label Style", minWidth:myLabelWidth});
         with(dialogColumns.add()){
              var myLabelStyleDropdown = dropdowns.add({stringList:myStyleNames, selectedIndex:0});
    And add the following lines after them:
    //Object style to apply to the text frame
    with(dialogRows.add()){
         with(dialogColumns.add()){
              staticTexts.add({staticLabel:"Label Object Style", minWidth:myLabelWidth});
         with(dialogColumns.add()){
              var myObjectStyleDropdown = dropdowns.add({stringList:myObjectStyleNames, selectedIndex:0});
    3. Look for the line:
    var myLabelStyle = myStyleNames[myLabelStyleDropdown.selectedIndex];
    And add this line before or after it:
    var myObjectStyleName = myObjectStyleNames[myObjectStyleDropdown.selectedIndex];
    4. Look for the line:
    myAddLabels(myLabelType, myLabelHeight, myLabelOffset, myLabelStyle);
    And change it to:
    myAddLabels(myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, myObjectStyleName);
    5. Look for the line:
    function myAddLabels(myLabelType, myLabelHeight, myLabelOffset, myLabelStyleName){
    And change it to:
    function myAddLabels(myLabelType, myLabelHeight, myLabelOffset, myLabelStyleName, myObjectStyleName){
    6. Look for the line:
    myAddLabel(myDocument, myGraphics[myCounter], myLabelType, myLabelHeight, myLabelOffset, myLabelStyle);
    And change it to:
    myAddLabel(myDocument, myGraphics[myCounter], myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, myObjectStyleName);
    7. Look for the line:
    function myAddLabel(myDocument, myGraphic, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle){
    And change it to:
    function myAddLabel(myDocument, myGraphic, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, myObjectStyleName){
    8. Look for the line:
    var myTextFrame = myFrame.parent.textFrames.add(myLabelLayer, undefined, undefined,{geometricBounds:[myY1, myX1, myY2, myX2], contents:myLabel});
    And add the following line after it:
    myTextFrame.applyObjectStyle(app.documents.item(0).objectStyles.item(myObjectStyleName), true);
    9. (Optional) Look for the line:
    myTextFrame.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset;
    And delete it or put "//" in front of it--this will let the object style take care of setting the first baseline offset method.
    After you make these changes, the script adds the object style dropdown to the dialog:
    Thanks,
    Ole

  • Change font in Illustrator cs4 js

    I need to assign specific font to my text and it doesn't work. What am I doing wrong:
    var my_OUTSIDE_TextFrame = myInstrLayer.textFrames.add();
    my_OUTSIDE_TextFrame.geometricBounds = ["1.6 in", "1 in", "1.85 in", "2.75 in"];
    my_OUTSIDE_TextFrame.contents = "OUTSIDE";
    var myParagraph = my_OUTSIDE_TextFrame.paragraphs.item(0);
    try{
    myParagraph.appliedFont = app.fonts.item("Myriad Pro");
    catch(e){}
    try{
    myParagraph.fontStyle = "Bold";
    catch(e){}
    myParagraph.pointSize = 30;
    And it's not placing it where I want it either.
    Thank you very much for your help.
    Yulia

    Hi yulia,
    i maked some changes on your script:
    - what is it item(0) instruction ??
    use instead paragraphs[0]
    - moreover you can use fontStyle.. it doesn't exist , it's textFont.stye but only for read, you can't assign "bold" or other style...
    to put a differents style, you need to attribute when you call the font name "MyriadPro-Bold".
    (** to obtain exact name you need, i have attritube first manually, and check his name with myParagraph.characterAttributes.textFont.name, to be sure avoid error name OR use my second script below**)
    - you use paragraphs instruction, but i'm not sure that is really usefull, because you have created a text first and you can thus include your properties (font name and style) exept if you envisaged to change font before a paragraphs
    - what is it pointSize ? doesn't exist also.. simply use size if you want change the size of textFont
    For this remark, i recommande you to see this post
    now, below an updated of your script
    #target illustrator
    var doc=app.activeDocument;
    var myInstrLayer=doc.layers.add();
    var my_OUTSIDE_TextFrame = myInstrLayer.textFrames.add();
    my_OUTSIDE_TextFrame.geometricBounds = ["1.6 in", "1 in", "1.85 in", "2.75 in"];
    my_OUTSIDE_TextFrame.contents = "OUTSIDE";
    var myParagraph = my_OUTSIDE_TextFrame.paragraphs[0];
    try{
    myParagraph.characterAttributes.textFont=app.textFonts.getByName("MyriadPro-Bold");
    catch(e){alert(e)}
    myParagraph.characterAttributes.size = 30;
    Also for 1$ more* i can propose you (for CS4) the same with drop down list below:
    #target illustrator
    var doc=app.activeDocument;
    var myInstrLayer=doc.layers.add();
    var my_OUTSIDE_TextFrame = myInstrLayer.textFrames.add();
    my_OUTSIDE_TextFrame.geometricBounds = ["1.6 in", "1 in", "1.85 in", "2.75 in"];
    my_OUTSIDE_TextFrame.contents = "OUTSIDE";
    var myParagraph = my_OUTSIDE_TextFrame.paragraphs[0];
    try{
    var ressource="dialog { text: 'Font List'}";
    var item=new Array();
    var dlg=new Window(ressource);
    var dd=dlg.add('dropdownlist',undefined);
    for( j=app.textFonts.length-1;j>-1;j--){dd.add('item',app.textFonts[j].name); }    
    dlg.btnRND=dlg.add('button',undefined,'Choose this font.',{name:'ok'});
    dlg.btnCANCEL=dlg.add('button',undefined,'Cancel',{name:'cancel'});
    dlg.show();
    for (k=dd.items.length-1;k>-1;k--){
    if (dd.items[k].selected){myParagraph.characterAttributes.textFont=app.textFonts.getByName(dd.items[k])}    
    catch(e){alert(e)}
    myParagraph.characterAttributes.size = 30;
    See you, art.chrome
    * this is a joke, i didn't ask for money !

  • [JS][CS6] Change hyperlink page destination

    Hi people!
    I bet this is simple, but I can't work it out.. and documentation is scarce.
    I want to change the PageDestination of a certain hyperlink via javascript.
    Lets go with this:
    app.activeDocument.hyperlinks.itemByName("Hyperlänk 8").destinationPage = 1 (or something else)
    ...the above doesn't work. What should I use instead of ".destinationPage"?
    Thanks

    PrntScr wrote:
    What should I use instead of ".destinationPage"?
    A page, not a number. A number could mean anything, whereas a page is .. a page
    But this
    app.activeDocument.hyperlinks.itemByName("Hyperlink 1").destinationPage = app.activeDocument.pages[0];
    does not work, because you forgot a level. A hyperlink has a destination, not a destination page, because hyperlinks can point to various items -- see http://jongware.mit.edu/idcs5/pc_Hyperlink.html.
    So, use this
    app.activeDocument.hyperlinks.itemByName("Hyperlink 1").destination.destinationPage = app.activeDocument.pages[0];
    and it will work, but only if the destination type already is a "HyperlinkPageDestination". If it's not, you have to add it first to your document's list of hyperlinkPageDestinations -- which is returned as a new object -- and then assign this object to the 'destination' property.

  • How change size of an anchored object ?

    Hello, I make a script that change size of a element by looking name (label and name).
    So It's work very well :
    var myStories = app.activeDocument.pageItems.everyItem().getElements();
    for(var i=0;i<myStories.length;i++){
    if(myStories[i].name=="Post_it"){
    var g_obj1 = get1(myStories[i]);
    var g_obj2 = get2(myStories[i]);
    var g_obj3 = get3(myStories[i]);
    var g_obj4 = get4(myStories[i]) + 5 ;
    myStories[i].geometricBounds = [g_obj1,g_obj2,g_obj3,g_obj4];
    But when I copy it and paste in a text to do a anchored object, it doesn't work!
    I check the name and the label, it's the same.
    Why it doesn't work when the object in anchored and how can I resolved it ?
    Thanks a lot!

    Yes! Very nice ! Thank a lot !
    Like this :
    var myStories = app.activeDocument.allPageItems;
    for(var i=0;i<myStories.length;i++){
            if(myStories[i]  instanceof TextFrame){
                    if(myStories[i].name=="Post_it" || myStories[i].label=="Post_it"){
                            var num_page_active = myStories[i].parentPage.name;
                            alert(num_page_active);
                            var g_obj1 = get1(myStories[i]);
                            var g_obj2 = get2(myStories[i]);
                            var g_obj3 = get3(myStories[i]);
                            var g_obj4 = get4(myStories[i]) + 5 ;
                            myStories[i].geometricBounds = [g_obj1,g_obj2,g_obj3,g_obj4];
    So, It's work! Now, I would like to do this only on the even page.
    In CS5, all is ok :
    var myStories = app.activeDocument.allPageItems;
    for(var i=0;i<myStories.length;i++){
            if(myStories[i]  instanceof TextFrame){
                    if(myStories[i].name=="Post_it" || myStories[i].label=="Post_it"){
                            var num_page_active = myStories[i].parentPage.name;
                             Number.prototype.isEven = function (){return (this%2 == 0) ? true : false;}
                            if(Number(num_page_active).isEven()==false){
                                var g_obj1 = get1(myStories[i]);
                                var g_obj2 = get2(myStories[i]);
                                var g_obj3 = get3(myStories[i]);
                                var g_obj4 = get4(myStories[i]) + 5 ;
                                myStories[i].geometricBounds = [g_obj1,g_obj2,g_obj3,g_obj4];
                                myStories[i].name="Post_it_Dec";
                                myStories[i].label="Post_it_Dec";
    But in CS4, the parent.name give me some problème that I can't resolved.
    In CS4, it does'nt know ".name" but ".label" only.
    So this does'nt work for CS4 :
    var myStories = app.activeDocument.allPageItems;
    for(var i=0;i<myStories.length;i++){
                                  if( myStories[i].label=="Post_it"){
                                            myStories[i].select();
                                            var num_page_active = myStories[i].parent.name;
                                            Number.prototype.isEven = function (){return (this%2 == 0) ? true : false;}
                                            if(Number(num_page_active).isEven()==false){
                                       var g_obj1 = get1(myStories[i]);
                                                                          var g_obj2 = get2(myStories[i]);
                                                                          var g_obj3 = get3(myStories[i]);
                                                                          var g_obj4 = get4(myStories[i]) + 5 ;
                                                                          myStories[i].geometricBounds = [g_obj1,g_obj2,g_obj3,g_obj4];
                                                                          myStories[i].label ="Post_it_Dec";
    Can you help me here or I create a new topic?

  • Changing script from CS2 to CS4

    Hi everyone!
    Having a bit of a problem (not to mention working against a deadline) with an old CS2 script created for a client. ESTK throws up an "Undefined is not an object" error.
    Below is the code that seems to be the culprit. ESTK stops on the line after the .place(), assuming here that it's because the .place() doesn't return a proper object or something like that (I hate when they change scripting around too much).
    Basically, what it does is placing an image into the first paragraph of a table cell. It then tries to set the dimensions to a "maximum" size and then fits the image proportionally to those dimensions.
    > tmpBild = "B0000843.jpg"; //temporary for testing
    newTable.rows[newTable.bodyRowCount-1].cells[4].contents = "\r";
    tmpPara = newTable.rows[newTable.bodyRowCount-1].cells[4].paragraphs.item(0);
    tmpPara.justification = Justification.centerAlign;
    tmpImg = tmpPara.place( PICBASE + tmpBild );
    tmpImg.parent.visibleBounds = ["0mm","0mm","38.236mm","38.236mm"];
    tmpImg.parent.geometricBounds = ["0mm","0mm","38.236mm","38.236mm"];
    tmpImg.fit( FitOptions.proportionally );
    tmpImg.parent.fit( FitOptions.frameToContent );
    tmpImg.parent.strokeColor = "Paper";
    tmpImg.parent.strokeAlignment = StrokeAlignment.centerAlignment;
    tmpImg.parent.strokeWeight = "5pt";
    tmpImg.parent.strokeType = app.strokeStyles.item("Thick - Thin");
    Can anybody help convert this so it works for InDesign CS4? In the meantime, I will try to take care of the rest of the script.
    Btw, I have/had a scripting
    b reference
    in PDF format for InDesign CS2, is there anywhere that I can download that for CS4, I know it was very helpful back then.

    What I ended up doing was create roughly enough pages in the document and create linked text frames on all pages, thus letting the table created in the first text frame flow as long as the document has enough pages. In the end processing, I then remove all the pages but the first one, effectively getting one page with one text frame containing all table contents.
    This was the only way I could find to get around this problem. No matter what I did, placing content into a table cell that was overflowing a text frame just didn't work.
    Here's the part where I create the pages (variable myMaxPages contains your estimated maximum number of pages). Please note in app.documents.add() that it is set to false to NOT open a window (speeds it up very slightly if you have a huge number of pages). You can remove the false and the myDocument.windows.add() statement if you don't want this or for debug purposes. The formatting mechanism on these forums seem broken, but the following code should be ok/readable once properly formatted.
    >myDocument = app.documents.add( false );
    with(myDocument) {
    for( i = 0; i < myMaxPages; i++ ) {
    myPage = pages.item(i);
    with(myPage) {
    if( i > 0 ) { myPrevFrame = myTextFrame; }
    myTextFrame = textFrames.add();
    with( myTextFrame ) {
    if( i == 0 ) {
    myTable = tables.add();
    with( myTable ) {
    bodyRowCount = 1;
    columnCount = 5;
    } else {
    if( i > 0 ) { previousTextFrame = myPrevFrame; }
    if( i < myMaxPages - 1 ) {
    pages.add();
    myDocument.windows.add();
    While fiddling with it, I also updated my image placement code a bit:
    > var myCell = myTable.rows[myTable.bodyRowCount-1].cells[4];
    myCell.contents = "\r";
    myCell.paragraphs.item(0).justification = Justification.centerAlign;
    var myRect = myCell.insertionPoints[0].textFrames.add();
    myRect.contentType = ContentType.unassigned;
    myRect.visibleBounds = ["0mm","0mm","38.236mm","38.236mm"];
    myRect.geometricBounds = ["0mm","0mm","38.236mm","38.236mm"];
    var myFile = File(PICBASE + tmpBild);
    if( myFile.exists ) {
    var myImage = myRect.place( myFile );
    myRect.fit( FitOptions.proportionally );
    myRect.fit( FitOptions.frameToContent );
    Maybe this helps someone, maybe it doesn't. Can't say that I'm happy with the behaviour of getting errors and being unable to place content in table cells that is overflowing out of a text frame, but I needed to solve it, and this is how I did it.
    Of course, if anyone else has a better solution to placing images into table cells that may be in the overflowing part of a text frame, go ahead and share with the rest of us, please.

  • Change X, Y position of a text frame based on some conditions

    Hi All,
    I am trying to re-position the Y position alone of all text frames in a documennt if that text frame has certain Y position. Here is the code I tried.
    It works, but, it place all the text frames in to the given myTextFrame.move ( ["216.425 pt","54 pt"] ); one on another. Whereas, I need to change Y position of only the text frames with the following conditions.
    The conditions are:
    If X="216.425 pt" AND Y="103.89 pt", change to X="216.425 pt" and Y="54 pt"   OR
    If X="216.425 pt" AND Y="78.945 pt", change to X="216.425 pt" and Y="54 pt"    OR
    If X="216.425 pt" AND Y="79.157 pt", change to X="216.425 pt" and Y="54 pt"    OR
    If X="213.425 pt" AND Y="486.647 pt", change to X="216.425 pt" and Y="54 pt"    OR
    If X="213.425 pt" AND Y="74.409 pt", change to X="216.425 pt" and Y="54 pt"   
    Please help me on this to add the above conditions into the following code and reposition only the text frames has the above said XY positions.  Is there anyother way other than "move" statement?
    var myDocument=app.activeDocument;
    var myPages=myDocument.pages;
        for(p=0;p<myPages.length;p++) {
        var allTextFrames=myPages[p].textFrames;
            for (s=0; s<allTextFrames.length; s++) {
                        var myTextFrame = allTextFrames[s];
                        var myTextFrameBounds =  myTextFrame.geometricBounds;
                        var properly_aligned = "54 pt";
                            if ((myTextFrameBounds[0] = "103.89 pt") && (myTextFrameBounds[1] ="216.425 pt")) {
                                myTextFrame.move ( ["216.425 pt","54 pt"] );

    Hi Jongware,
    Thanks for your reply.
    I have modified the code little bit after referring one of the post. Here is the updated code. It is working fine for the whole number (var oldposition1) as input value and does not work for decimal values (var oldposition2, var oldposition3, var oldposition4 and var oldposition5). However, it repositions the frames with decimal values (newposition1, newposition2 and newposition3). I am facing problem with the decimal input values for original position of text frames. Is there any other way to give decimal values as input as my document comes with these decimal values as X, Y position.
    var oldposition1 = [216, 103] // original position, upper left corner
    var oldposition2 = [216.425, 78.945] // original position, upper left corner
    var oldposition3 = [216.425, 79.157] // original position, upper left corner
    var oldposition4 = [213.425, 74.409] // original position, upper left corner
    var oldposition5 = [213.425, 486.647] // original position, upper left corner
    var newposition1 = [216.425, 54] // new position, upper left corner
    var newposition2 = [36, 54] // new position, upper left corner
    var newposition3 = [216.425, 437.4] // new position, upper left corner
    var myObjects = app.activeDocument.pageItems.everyItem().getElements();
    for (var i=0; i<myObjects.length; i++){
        if (Math.round(myObjects[i].geometricBounds[1])==oldposition1[0]&&Math.round(myObjects[i].ge ometricBounds[0])==oldposition1[1]){
            myObjects[i].move(newposition1);
        else if (Math.round(myObjects[i].geometricBounds[1])==oldposition2[0]&&Math.round(myObjects[i].ge ometricBounds[0])==oldposition2[1]){
            myObjects[i].move(newposition1);
        else if (Math.round(myObjects[i].geometricBounds[1])==oldposition3[0]&&Math.round(myObjects[i].ge ometricBounds[0])==oldposition3[1]){
            myObjects[i].move(newposition1);
        else if (Math.round(myObjects[i].geometricBounds[1])==oldposition4[0]&&Math.round(myObjects[i].ge ometricBounds[0])==oldposition4[1]){
            myObjects[i].move(newposition1);
        else if (Math.round(myObjects[i].geometricBounds[1])==oldposition5[0]&&Math.round(myObjects[i].ge ometricBounds[0])==oldposition5[1]){
            myObjects[i].move(newposition3);

  • With CS4, some things have changed

    This topic is not about new features but changes, primarily in the object model, that will affect scripts that run perfectly well under CS3.
    Bear in mind that as before, you can create a folder for previous version scripts and run from there, in which case the previous object model is employed -- indeed, CS4 allows you to do this for scripts all the way back to CS scripts. The Object Model Viewer in ESTK, once you've initialized it by opening it once and choosing the InDesign CS4 Object Model, allows you to see all four supported object models.

    This script produces different results in CS3 and CS4:
    var myDoc = app.documents.add();
    var myTF = myDoc.pages[0].textFrames.add({geometricBounds:myDoc.pages[0].bounds});
    var myTable = myTF.parentStory.tables.add(LocationOptions.atEnd);
    myTable.bodyRowCount = 7;
    for (var j = myTable.bodyRowCount - 1; j >= 0; j--) {
        myTable.cells.item("0:" + j).contents = String(j);
    var myArray = myTable.columns[0].cells.itemByRange(1, myTable.bodyRowCount -1).texts[0].contents;
    alert(myArray)
    In CS3, you get an alert that reads:
    1,2,3,4,5,6
    In CS4, you get just:
    1
    To get the same alert in CS4 you need to use this to construct myArray:
    var myArray = myTable.columns[0].cells.itemByRange(1, myTable.bodyRowCount-1).cells.everyItem().contents;
    Dave

Maybe you are looking for

  • Updating fully depreciated assets during creation of subsequent depreciation area

    I am subsequently adding multiple depreciation areas in SAP. The system has been live for many years with a legacy system handling the depreciation for the tax books via dual maintenance.  I have been able to bring in the new areas via AFBN without i

  • DOM Programming in class for ABAP Mapping?

    Hi All!! I am struggling in transforming XML to be mapping target structures in using ABAP Mapping. so i am on developing class with DOM. i would like to know how many <person> derived from source xml, so what method should i use so that i can get th

  • Extract XML from an XML File

    Hi All, I have an xml file from which data has to be extracted and inserted into table. XML file looks like this.. <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE labels SYSTEM "label.dtd"> <labels FORMAT="Harvest Label for Lot Proje

  • Why disappear name in my i-phone?

    why disappear contact in my iphone?

  • Completed an album on Mac, won't show on iPhone

    So We The Kings had released four singles from their new CD which I bought. Tonight, they released the entire CD and I did the "Complete my album" option. The singles did not go onto the album, so I went into their info and changed their Album name t