Skip to main content
January 16, 2020
Answered

Script to run find/change query by name

  • January 16, 2020
  • 2 replies
  • 1888 views

Hi all,

Does anyone know how to run a single "Find/Change query by name" with JS that I can add into my script without downloading one of the find/change scripts and using them separately?

Thanks, Bren

This topic has been closed for replies.
Correct answer Jongware

app.loadFindChangeQuery (name, mode) loads the Find/Change dialog with the data from one of your previously saved queries (see https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html#d1e42173__d1e47301 for full details).

So this

 

app.loadFindChangeQuery ("italic spaces", SearchModes.GREP_SEARCH);
app.activeDocument.changeGrep();

 

is enough to load my own "italic spaces" preset and run it on the current document.

2 replies

Jongware
Community Expert
JongwareCommunity ExpertCorrect answer
Community Expert
January 16, 2020

app.loadFindChangeQuery (name, mode) loads the Find/Change dialog with the data from one of your previously saved queries (see https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Application.html#d1e42173__d1e47301 for full details).

So this

 

app.loadFindChangeQuery ("italic spaces", SearchModes.GREP_SEARCH);
app.activeDocument.changeGrep();

 

is enough to load my own "italic spaces" preset and run it on the current document.

January 16, 2020

Hi Jongware,

That has worked perfectly for the GREP search, can this also be done for the OBJECT and TEXT fields as my find/change uses all of these?

Thank you for your help, Bren

brian_p_dts
Community Expert
Community Expert
January 16, 2020
Community Expert
January 16, 2020

Hi Bren,

 

I did not quite get what you are asking, what do you mean by running a query by name. Did you look into FindChangeList script shipped with InDesign, the idea for that is to save your queries in a text file and the script executes those queries, something like this would not work for your workflow?

 

-Manan

-Manan
January 16, 2020

Hi Manan, thanks but I need script I can add to an existing script instead of a standalone.

Thank you, Bren