4 Replies Latest reply on Mar 17, 2015 11:07 AM by elwiraz27029292

    How move document (viewport) to X,Y


      Hi all, I'm making script which will have similar behavior to original Find Text script. I stuck on part where I have X,Y coordinates from item where I need move document - I mean make this area focused and visible for user (like tou Find Text and clikc Find next then document move there). How should I make it? Anyone?

        • 1. Re: How move document (viewport) to X,Y
          TᴀW Adobe Community Professional & MVP

          If you have some text, say myText, you can simply do:



          • 2. Re: How move document (viewport) to X,Y
            elwiraz27029292 Level 1

            hmm maybe I will put part of code here



                var doc = app.activeDocument;

                app.findTextPreferences = NothingEnum.nothing;

                app.changeTextPreferences = NothingEnum.nothing;

                app.findChangeTextOptions.caseSensitive = false;

                app.findChangeTextOptions.includeFootnotes = false;

                app.findChangeTextOptions.includeHiddenLayers = false;

                app.findChangeTextOptions.includeLockedLayersForFind = false;

                app.findChangeTextOptions.includeLockedStoriesForFind = false;

                app.findChangeTextOptions.includeMasterPages = false;

                app.findChangeTextOptions.wholeWord = false;

                app.findTextPreferences.findWhat = ",";


                var items = doc.findText();


            .... and I have for it palette window with button to find next which looks


            nextBtn.onClick = function () {


                         if(itemIndex > items.length)

                            return alert('Done');


                         if(!app.selection[0] instanceof Character) {

                             return alert('Done');


                          var x = app.selection[0].horizontalOffset;

                          var y = app.selection[0].baseline;


                          items[itemIndex].parent.showText(); <- it is right? not working. If items[itemIndex] is character so his parent must be Text Frame?


            • 3. Re: How move document (viewport) to X,Y
              Jump_Over Level 5




              showText() function works with texts (insertionPoints, character, word, line, ... etc) ONLY

              (the one with "baseline" property)


              • 4. Re: How move document (viewport) to X,Y
                elwiraz27029292 Level 1

                thanks guys! it works