• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how can i show a text with findText()

New Here ,
Feb 14, 2011 Feb 14, 2011

Copy link to clipboard

Copied

Dear,

I use findText() to search a string on a existing document !

I works when i use the lenght method it who's me the number fo item fiound.

I want to go the page where it have been find and make  selected the text found.


Thanks you for your help !

TOPICS
Scripting

Views

555

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Feb 14, 2011 Feb 14, 2011

Hello

I do always this way.

select each result and zoom, you will jump to the page.

var doc = app.documents[0];
app.findTextPreferences = null;

//current zoom percentage
var zoom_bk = app.activeWindow.zoomPercentage;

//keyword
app.findTextPreferences.findWhat = "anytext";

//found collection
var result = app.findText();

for (var i=0; i < result.length; i++) {
     result.select();
     app.activeWindow.zoomPercentage = 400;
     //jump to each "anytext"
     alert(app.findTextPreferences.findWha
...

Votes

Translate

Translate
Contributor ,
Feb 14, 2011 Feb 14, 2011

Copy link to clipboard

Copied

Hello

I do always this way.

select each result and zoom, you will jump to the page.

var doc = app.documents[0];
app.findTextPreferences = null;

//current zoom percentage
var zoom_bk = app.activeWindow.zoomPercentage;

//keyword
app.findTextPreferences.findWhat = "anytext";

//found collection
var result = app.findText();

for (var i=0; i < result.length; i++) {
     result.select();
     app.activeWindow.zoomPercentage = 400;
     //jump to each "anytext"
     alert(app.findTextPreferences.findWhat + " was found " + (i+1) + "/" + result.length);
};
app.activeWindow.zoomPercentage = zoom_bk;

mg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 15, 2011 Feb 15, 2011

Copy link to clipboard

Copied

LATEST

Thank you !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines