Copy link to clipboard
Copied
Hi Experts,
I want to get all the saved queries in Find/Change.
Query names and their query data, i.e replace text, find text...etc
Only thing I could find was IFindChangeOptions but it does not have classes related to queries.
Can you please help me.
Hello ddarz4u​,
I also could not find any way in the C++ sdk to get this list. It seems this is not meant to be accessible by a direct api call. However i have a way to achieve what you need, the custom queries are saved as XML files, you can parse these files and then load a particular query(could not find a C++ sdk to do the same directly). So you could traverse the folder location where the custom queries are saved, use it to get the list of all the queries(file name is displayed in the File C
...Copy link to clipboard
Copied
Hello ddarz4u​,
I also could not find any way in the C++ sdk to get this list. It seems this is not meant to be accessible by a direct api call. However i have a way to achieve what you need, the custom queries are saved as XML files, you can parse these files and then load a particular query(could not find a C++ sdk to do the same directly). So you could traverse the folder location where the custom queries are saved, use it to get the list of all the queries(file name is displayed in the File Change dialog). The you can parse the XML file to set the appropriate interfaces to make the find change query, and execute it. Let me know if you find a direct API to load query as present in the JS api, alternatively you could call the JS code from C++ plugin.
Look at the load queries section in the following URL to get the locations at which the custom queries are saved
https://helpx.adobe.com/in/indesign/using/find-change.html#find_change_items_using_queries
Hope this helps.
-Manan
Copy link to clipboard
Copied
Manan is right, there's no straight api to load the query names, it's a manual work. But once you get the IDFile queryXMLFile, load query with command
kFCQueryXMLReaderCmdBoss
InterfacePtr<ICommand>queryCmd(CmdUtils::CreateCommand(kFCQueryXMLReaderCmdBoss));
InterfacePtr<ISysFileData> sysFile(queryCmd, UseDefaultIID());
sysFile->Set(queryXMLFile);
CmdUtils::ProcessCommand(queryCmd);
Then you can use IFindChangeOptions to get the options data, example:
InterfacePtr<IFindChangeOptions>pFindChangeOptions((IFindChangeOptions*)::QuerySessionPreferences(IID_IFINDCHANGEOPTIONS));
WideString findString = pFindChangeOptions->GetFindString(IFindChangeOptions::kTextSearch);
WideString replaceString = pFindChangeOptions->GetReplaceString(IFindChangeOptions::kTextSearch);
Copy link to clipboard
Copied
Thanks for the insight Alo, i missed the command (the chm search has its own idiosyncrasies )
Copy link to clipboard
Copied
Hello,
From jsx, app.loadFindChangeQuery.
P.
Copy link to clipboard
Copied
Thanks Pickory​​
To get this, we should have to have query names list?
Copy link to clipboard
Copied
Hello,
For the docs.
void loadFindChangeQuery (queryName: string, searchMode: SearchModes)
Value |
| |||||||||||||||
Usage | In functionvoid Application.deleteFindChangeQuery (queryName: string, searchMode: SearchModes) void Application.loadFindChangeQuery (queryName: string, searchMode: SearchModes) void Application.saveFindChangeQuery (queryName: string, searchMode: SearchModes) |