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

Open Find/Change panel by script in InDesign!

New Here ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Hello,

In InDesign, I want to use the following code to open the Find/Change panel:
app.panels.itemByName("$ID/Find/Change...").visible = true;
Unfortunately, I have not been successful. On the other hand, the code below:
var myMenuAction = app.menuActions.item("Find/Change...");
myMenuAction.invoke();
cannot specify visible = true. Any help is highly appreciated.


Kind regards, Aprking

TOPICS
Scripting

Views

1.5K

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 8 Correct answers

Community Expert , Jun 26, 2023 Jun 26, 2023

Does this work

app.menuActions.item("$ID/Find/Change...").invoke();

 

 

Votes

Translate

Translate
Guide , Jun 26, 2023 Jun 26, 2023
app.menuActions.itemByID(18694).invoke();
 
(^/)  The Jedi

Votes

Translate

Translate
Community Expert , Jun 26, 2023 Jun 26, 2023

Hi @Sherylz , Find/Change... is not a panel, so you have to specify a menuAction to open it, and it won’t open unless the menu item is enabled—there’s no visible property, but there is an enabled property. So (Code Edited):

 

 

var fc = app.menuActions.itemByID("18694");
if(fc.enabled){  
    fc.invoke();  
}

 

 

What are you going to do in the dialog when it is open? Text and Grep searches are fully scriptable without opening the dialog.

Votes

Translate

Translate
Community Expert , Jun 26, 2023 Jun 26, 2023

Sorry, there was a type-o in my post should be itemByID as @FRIdNGE is showing but with the enabled test:

 

var fc = app.menuActions.itemByID(18694);
if(fc.enabled){  
    fc.invoke();  
} 

 

 

But this should also work:

 

var fc = app.menuActions.itemByName("Find/Change...");
if(fc.enabled){  
    fc.invoke();  
} 

 

 

Votes

Translate

Translate
Guide , Jun 26, 2023 Jun 26, 2023

… Maybe I don't understand something but theese two codes give the same result if the Find/Replace window is or not visible.

 

Rob:

var fc = app.menuActions.itemByID(18694);
if(fc.enabled){
fc.invoke();
}

 

FRIdNGE:

app.menuActions.itemByID(18694).invoke();

 

(^/)

Votes

Translate

Translate
Community Expert , Jun 26, 2023 Jun 26, 2023

but theese two codes give the same result

 

Hi @FRIdNGE , You are right they do the same. I was just trying to show there is an .enabled property, but no .visible property. I could add an alert in case the menu item happens to be grayed out:

 

var fc = app.menuActions.itemByName("Find/Change...");
if(fc.enabled){  
    fc.invoke();  
} else {
    alert("Find/Change is not Available")
}

 

Screen Shot 22.png

Votes

Translate

Translate
Community Expert , Jun 26, 2023 Jun 26, 2023

Is there a method like item("$ID/Find/Change...")

 

That should also work, see @Eugene Tyson ’s post. But as with the other options nothing would happen if the menu item is grayed out and disabled. So:

 

 

var fc = app.menuActions.item("$ID/Find/Change...");
if(fc.enabled){  
    fc.invoke();  
} else {
    alert("Find/Change is not Available")
}

 

 

Votes

Translate

Translate
Guide , Jun 26, 2023 Jun 26, 2023

Rob,

 

First, "app.menuActions.itemByName("Find/Change...")" doesn't work on a French ID version, you will need: app.menuActions.itemByName("Rechercher/Remplacer...").

Then, your code is irrelevant if the op plays on an open doc! That is, I suppose, a minimal condition (no sense trying to run a find/replace without a target document).

 

(^/)

Votes

Translate

Translate
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Does this work

app.menuActions.item("$ID/Find/Change...").invoke();

 

 

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
Contributor ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

app.menuActions.item("$ID/Find/Change...").invoke();

No,Cannot specify visible = true. Not sure about the state of the panel.

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
Guide ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

app.menuActions.itemByID(18694).invoke();
 
(^/)  The Jedi

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
Contributor ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

In this case, there is still no information about the current state of the Find/Change panel, and it can only be toggled between visible and hidden.

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
Contributor ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

I apologize for any confusion. It is unclear whether the error is caused by the "/" symbol or the "..." symbol in Find/Change..., or if Find/Change... simply does not support parameters like "visible = true".

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
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Hi @Sherylz , Find/Change... is not a panel, so you have to specify a menuAction to open it, and it won’t open unless the menu item is enabled—there’s no visible property, but there is an enabled property. So (Code Edited):

 

 

var fc = app.menuActions.itemByID("18694");
if(fc.enabled){  
    fc.invoke();  
}

 

 

What are you going to do in the dialog when it is open? Text and Grep searches are fully scriptable without opening the dialog.

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
Contributor ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Error Number: 45

Error String: Object is invalid

Line: 2

Source: if (fc.enabled) {

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
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Do you have a document open?

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
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Sorry, there was a type-o in my post should be itemByID as @FRIdNGE is showing but with the enabled test:

 

var fc = app.menuActions.itemByID(18694);
if(fc.enabled){  
    fc.invoke();  
} 

 

 

But this should also work:

 

var fc = app.menuActions.itemByName("Find/Change...");
if(fc.enabled){  
    fc.invoke();  
} 

 

 

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
Contributor ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Testing successful! You are amazing. Many people have discussed this problem before without finding a solution. 

 

In addition, the ID 18694 may not be suitable for all versions. Is there a method like item("$ID/Find/Change...")?

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
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

That was the first thing I posted

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
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Is there a method like item("$ID/Find/Change...")

 

That should also work, see @Eugene Tyson ’s post. But as with the other options nothing would happen if the menu item is grayed out and disabled. So:

 

 

var fc = app.menuActions.item("$ID/Find/Change...");
if(fc.enabled){  
    fc.invoke();  
} else {
    alert("Find/Change is not Available")
}

 

 

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
Guide ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

… Maybe I don't understand something but theese two codes give the same result if the Find/Replace window is or not visible.

 

Rob:

var fc = app.menuActions.itemByID(18694);
if(fc.enabled){
fc.invoke();
}

 

FRIdNGE:

app.menuActions.itemByID(18694).invoke();

 

(^/)

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
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

but theese two codes give the same result

 

Hi @FRIdNGE , You are right they do the same. I was just trying to show there is an .enabled property, but no .visible property. I could add an alert in case the menu item happens to be grayed out:

 

var fc = app.menuActions.itemByName("Find/Change...");
if(fc.enabled){  
    fc.invoke();  
} else {
    alert("Find/Change is not Available")
}

 

Screen Shot 22.png

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
Contributor ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

var fc = app.menuActions.itemByName("Find/Change...");
if(fc.enabled){
fc.invoke();
}

Error Number: 45

Error String: Object is invalid

Line: 2

Source: if (fc.enabled) {

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
Guide ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

Rob,

 

First, "app.menuActions.itemByName("Find/Change...")" doesn't work on a French ID version, you will need: app.menuActions.itemByName("Rechercher/Remplacer...").

Then, your code is irrelevant if the op plays on an open doc! That is, I suppose, a minimal condition (no sense trying to run a find/replace without a target document).

 

(^/)

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
Community Expert ,
Mar 27, 2024 Mar 27, 2024

Copy link to clipboard

Copied

LATEST

Hi Rob,

this one is actually working with my German InDesign, it should also work with a French InDesign:

 

var fc = app.menuActions.itemByName("$ID/EditMenu_FindChange");
if(fc.enabled){  
    fc.invoke();  
} else {
    alert("Find/Change is not Available")
}

 

Regards,
Uwe Laubender
( Adobe Community Expert )

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
Community Expert ,
Jun 26, 2023 Jun 26, 2023

Copy link to clipboard

Copied

What exactly are you trying to achieve? 

 

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
Contributor ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

app.panels.itemByName("$ID/Character").visible = true;

Just like this code, it opens the panel when executed, instead of toggling between hidden and visible.

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
Contributor ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

 

Today, I performed a detailed test of the code snippet:

 

Copy Code
var fc = app.menuActions.itemByID(18694);
if(fc.enabled){  
    fc.invoke();  
}   

Unfortunately, the "Find/Change" panel started switching back and forth between hidden and visible again. I'm frustrated...

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
Guide ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

No comment but I'm a little lost reading this thread and all these "correct answers" that don't seem finally to be so correct!

 

(^/)

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
Contributor ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

I'm sorry, you're right! The answer we obtained yesterday was not correct.

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
Community Expert ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

panel started switching back and forth between hidden and visible again

 

If you run the script while the Find/Change dialog is open it would close the dialog window.

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
Contributor ,
Jun 27, 2023 Jun 27, 2023

Copy link to clipboard

Copied

The code app.panels.itemByName("$ID/Character").visible = true; works, but unfortunately it does not support Find/Change...

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