I have my custom search field in html book layout. Is it any opportunity to use my search field to search data in my html files?
Yes, that’s possible thanks to the HEScript script engine of HTML Executable.
Can you explain? At now my search field is
<input type="text" name="search" / > and submit button =)
I tried to realize search with JS (creating object with chapters of book and parse them), but it finished bad (can’t understand how to get all chapters links from certain page (Book contents page))
Here is the idea you should implement:
Launches a full text search in the entire publication. The Search engine must have been enabled!
The search results are displayed in the navigation panel.
procedure StartFullSearch(const Query: String; ScriptFormatName: String);
Query: what you are looking for. You may use the logical operators AND, OR, NOT.
ScriptFormatName: script of the search engine. Must be “search.hex”.
- So go to the Scripts tab in HTMLEXE:
In the Publication Behavior, you have an “User Scripts” tab with a default UserMain script. This script contains pre-defined events. Just edit UserMain and add this code:
procedure DoSearch(text: string);
The function should execute the DoSearch event defined previously. To do so, use this JS code:
textsearch = // read value from input text
window.external.runHEScriptCom(“UserMain.DoSearch|” + textsearch);