InDesign javascript to find overlapping textframes










0















is there anyway in InDesign using Javascript to search for any text frames in a document that overlaps? I've been looking through a document with all the properties of TextFrame and can't find anything that might tell whether there's any overlapping boxes or not.

I don't know Javascript but do know Ruby so i understand bits of it.










share|improve this question


























    0















    is there anyway in InDesign using Javascript to search for any text frames in a document that overlaps? I've been looking through a document with all the properties of TextFrame and can't find anything that might tell whether there's any overlapping boxes or not.

    I don't know Javascript but do know Ruby so i understand bits of it.










    share|improve this question
























      0












      0








      0








      is there anyway in InDesign using Javascript to search for any text frames in a document that overlaps? I've been looking through a document with all the properties of TextFrame and can't find anything that might tell whether there's any overlapping boxes or not.

      I don't know Javascript but do know Ruby so i understand bits of it.










      share|improve this question














      is there anyway in InDesign using Javascript to search for any text frames in a document that overlaps? I've been looking through a document with all the properties of TextFrame and can't find anything that might tell whether there's any overlapping boxes or not.

      I don't know Javascript but do know Ruby so i understand bits of it.







      javascript indesign






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 20 '15 at 8:20









      RebsRebs

      53




      53






















          2 Answers
          2






          active

          oldest

          votes


















          2














          Each Page object has got a read only attribute textFrames with alle textFrames on the page.
          Each textFrame has got a method visibleBounds which will return an array in the form of [x1,y1,x2,y2], so you can get the geometric bounds of this text frame.



          So you need to iterate over all the textFrames of the page, get the bounds of each textFrame and then you must check if any of them overlaps wich each other.






          share|improve this answer






























            0














            Here is a simple code to find text frames that overlap. It loops through all spreads in an active document and pauses to report an overlap. Check it out.



            app.activeDocument.viewPreferences.ruleOrigin = RuleOrigin.SPREAD_ORIGIN;
            //If you are going to work with pages, not spreads, change the line above to PAGE_ORIGIN;
            for (a = 0; a < app.activeDocument.spreads.length; a ++)
            var pg = app.activeDocument.spreads [a];
            for (b = 0 ; b < pg.textFrames.length; b ++)
            var r1 = pg.textFrames [b];
            for (c = 0 ; c < pg.textFrames.length; c ++)
            (gb1 [0] > gb2 [0] && gb1 [0] < gb2 [2] && gb1 [3] > gb2 [1] && gb1 [3] < gb2 [3])







            share|improve this answer

























            • Please make sure to test before posting: the first line of this script contains an error. The property is called rulerOrigin, not ruleOrigin.

              – usr2564301
              Mar 8 '16 at 20:39











            • Thanks. The subject is the the main code not the commented part. Did you try that before down-voting?

              – Michael
              Mar 12 '16 at 3:14











            • But does not work without (at least) this correction. You can't see it as it now has been deleted, but there was a complaint about that.

              – usr2564301
              Mar 12 '16 at 10:03










            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33231516%2findesign-javascript-to-find-overlapping-textframes%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Each Page object has got a read only attribute textFrames with alle textFrames on the page.
            Each textFrame has got a method visibleBounds which will return an array in the form of [x1,y1,x2,y2], so you can get the geometric bounds of this text frame.



            So you need to iterate over all the textFrames of the page, get the bounds of each textFrame and then you must check if any of them overlaps wich each other.






            share|improve this answer



























              2














              Each Page object has got a read only attribute textFrames with alle textFrames on the page.
              Each textFrame has got a method visibleBounds which will return an array in the form of [x1,y1,x2,y2], so you can get the geometric bounds of this text frame.



              So you need to iterate over all the textFrames of the page, get the bounds of each textFrame and then you must check if any of them overlaps wich each other.






              share|improve this answer

























                2












                2








                2







                Each Page object has got a read only attribute textFrames with alle textFrames on the page.
                Each textFrame has got a method visibleBounds which will return an array in the form of [x1,y1,x2,y2], so you can get the geometric bounds of this text frame.



                So you need to iterate over all the textFrames of the page, get the bounds of each textFrame and then you must check if any of them overlaps wich each other.






                share|improve this answer













                Each Page object has got a read only attribute textFrames with alle textFrames on the page.
                Each textFrame has got a method visibleBounds which will return an array in the form of [x1,y1,x2,y2], so you can get the geometric bounds of this text frame.



                So you need to iterate over all the textFrames of the page, get the bounds of each textFrame and then you must check if any of them overlaps wich each other.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 20 '15 at 8:44









                PatrickDPatrickD

                93136




                93136























                    0














                    Here is a simple code to find text frames that overlap. It loops through all spreads in an active document and pauses to report an overlap. Check it out.



                    app.activeDocument.viewPreferences.ruleOrigin = RuleOrigin.SPREAD_ORIGIN;
                    //If you are going to work with pages, not spreads, change the line above to PAGE_ORIGIN;
                    for (a = 0; a < app.activeDocument.spreads.length; a ++)
                    var pg = app.activeDocument.spreads [a];
                    for (b = 0 ; b < pg.textFrames.length; b ++)
                    var r1 = pg.textFrames [b];
                    for (c = 0 ; c < pg.textFrames.length; c ++)
                    (gb1 [0] > gb2 [0] && gb1 [0] < gb2 [2] && gb1 [3] > gb2 [1] && gb1 [3] < gb2 [3])







                    share|improve this answer

























                    • Please make sure to test before posting: the first line of this script contains an error. The property is called rulerOrigin, not ruleOrigin.

                      – usr2564301
                      Mar 8 '16 at 20:39











                    • Thanks. The subject is the the main code not the commented part. Did you try that before down-voting?

                      – Michael
                      Mar 12 '16 at 3:14











                    • But does not work without (at least) this correction. You can't see it as it now has been deleted, but there was a complaint about that.

                      – usr2564301
                      Mar 12 '16 at 10:03















                    0














                    Here is a simple code to find text frames that overlap. It loops through all spreads in an active document and pauses to report an overlap. Check it out.



                    app.activeDocument.viewPreferences.ruleOrigin = RuleOrigin.SPREAD_ORIGIN;
                    //If you are going to work with pages, not spreads, change the line above to PAGE_ORIGIN;
                    for (a = 0; a < app.activeDocument.spreads.length; a ++)
                    var pg = app.activeDocument.spreads [a];
                    for (b = 0 ; b < pg.textFrames.length; b ++)
                    var r1 = pg.textFrames [b];
                    for (c = 0 ; c < pg.textFrames.length; c ++)
                    (gb1 [0] > gb2 [0] && gb1 [0] < gb2 [2] && gb1 [3] > gb2 [1] && gb1 [3] < gb2 [3])







                    share|improve this answer

























                    • Please make sure to test before posting: the first line of this script contains an error. The property is called rulerOrigin, not ruleOrigin.

                      – usr2564301
                      Mar 8 '16 at 20:39











                    • Thanks. The subject is the the main code not the commented part. Did you try that before down-voting?

                      – Michael
                      Mar 12 '16 at 3:14











                    • But does not work without (at least) this correction. You can't see it as it now has been deleted, but there was a complaint about that.

                      – usr2564301
                      Mar 12 '16 at 10:03













                    0












                    0








                    0







                    Here is a simple code to find text frames that overlap. It loops through all spreads in an active document and pauses to report an overlap. Check it out.



                    app.activeDocument.viewPreferences.ruleOrigin = RuleOrigin.SPREAD_ORIGIN;
                    //If you are going to work with pages, not spreads, change the line above to PAGE_ORIGIN;
                    for (a = 0; a < app.activeDocument.spreads.length; a ++)
                    var pg = app.activeDocument.spreads [a];
                    for (b = 0 ; b < pg.textFrames.length; b ++)
                    var r1 = pg.textFrames [b];
                    for (c = 0 ; c < pg.textFrames.length; c ++)
                    (gb1 [0] > gb2 [0] && gb1 [0] < gb2 [2] && gb1 [3] > gb2 [1] && gb1 [3] < gb2 [3])







                    share|improve this answer















                    Here is a simple code to find text frames that overlap. It loops through all spreads in an active document and pauses to report an overlap. Check it out.



                    app.activeDocument.viewPreferences.ruleOrigin = RuleOrigin.SPREAD_ORIGIN;
                    //If you are going to work with pages, not spreads, change the line above to PAGE_ORIGIN;
                    for (a = 0; a < app.activeDocument.spreads.length; a ++)
                    var pg = app.activeDocument.spreads [a];
                    for (b = 0 ; b < pg.textFrames.length; b ++)
                    var r1 = pg.textFrames [b];
                    for (c = 0 ; c < pg.textFrames.length; c ++)
                    (gb1 [0] > gb2 [0] && gb1 [0] < gb2 [2] && gb1 [3] > gb2 [1] && gb1 [3] < gb2 [3])








                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Feb 5 '16 at 5:18

























                    answered Feb 5 '16 at 1:35









                    MichaelMichael

                    274




                    274












                    • Please make sure to test before posting: the first line of this script contains an error. The property is called rulerOrigin, not ruleOrigin.

                      – usr2564301
                      Mar 8 '16 at 20:39











                    • Thanks. The subject is the the main code not the commented part. Did you try that before down-voting?

                      – Michael
                      Mar 12 '16 at 3:14











                    • But does not work without (at least) this correction. You can't see it as it now has been deleted, but there was a complaint about that.

                      – usr2564301
                      Mar 12 '16 at 10:03

















                    • Please make sure to test before posting: the first line of this script contains an error. The property is called rulerOrigin, not ruleOrigin.

                      – usr2564301
                      Mar 8 '16 at 20:39











                    • Thanks. The subject is the the main code not the commented part. Did you try that before down-voting?

                      – Michael
                      Mar 12 '16 at 3:14











                    • But does not work without (at least) this correction. You can't see it as it now has been deleted, but there was a complaint about that.

                      – usr2564301
                      Mar 12 '16 at 10:03
















                    Please make sure to test before posting: the first line of this script contains an error. The property is called rulerOrigin, not ruleOrigin.

                    – usr2564301
                    Mar 8 '16 at 20:39





                    Please make sure to test before posting: the first line of this script contains an error. The property is called rulerOrigin, not ruleOrigin.

                    – usr2564301
                    Mar 8 '16 at 20:39













                    Thanks. The subject is the the main code not the commented part. Did you try that before down-voting?

                    – Michael
                    Mar 12 '16 at 3:14





                    Thanks. The subject is the the main code not the commented part. Did you try that before down-voting?

                    – Michael
                    Mar 12 '16 at 3:14













                    But does not work without (at least) this correction. You can't see it as it now has been deleted, but there was a complaint about that.

                    – usr2564301
                    Mar 12 '16 at 10:03





                    But does not work without (at least) this correction. You can't see it as it now has been deleted, but there was a complaint about that.

                    – usr2564301
                    Mar 12 '16 at 10:03

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33231516%2findesign-javascript-to-find-overlapping-textframes%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Syphilis

                    Darth Vader #20