In the last blog by Willam van Weelden we were acquainted with the capabilities of the Scripting support in RoboHelp and the variety of tasks/functionalities that can be automated using scripting (see also Willam’s Blog). In continuation with the exploration of the support of scripting in RoboHelp, we are providing a script which elaborates the power of scripting. This Script can be used to update marked glossary terms in RoboHelp project content to show up “Tool Tip” or “Text Popup” in the output.
The scripting feature (ExtendScript support) was introduced in RoboHelp 8 and thus the script should work on projects of RoboHelp version 8 and above. It can be run on any open project in RoboHelp that has marked Glossary terms. This script will update the marked terms with their corresponding definitions (according to the style defined by GlossaryStyle variable in the script and as per the glossary defined in the variable GlossaryName in the script).
More than to showcase the power of ExtendScript this has been the ask of many users from a long time, as by default the Glossary appears as an “Expanding text” in the output and when we click the glossary term in the output, it expands inline to show the definition thus making the content to re-flow on the page, which in certain cases may not be desirable hence the users wanted to be able to output Glossary as Tool tip or Text popup to avoid this re-flow.
About the script
- This script will update the marked glossary terms in the topics/master page and snippets with their corresponding definitions from the glossary defined.
There are two methods to place a marked glossary terms in any topic/snippet/master page
- You can drag the glossary from the Glossary pod into the topic/snippet/master page and a marked glossary is created
- You can run the “Glossary Hotspot wizard” and it will mark all the matching terms in all the topics in the project as glossary (this cannot be used to mark terms in snippet and master page)
Currently there are two possible settings in the script for the Glossary style
- Glossaries can be updated to appear as Tooltip
- Glossaries can be updated to appear as Text Popup
- After you have run the script, the updated project can be used to generate any desired output with the preferred Glossary style.
Generating Glossary Term as Text pop up/Tool Tip Using this ExtendScript
- Launch RoboHelp
- After you are completely done with all the content creation and styling in RoboHelp and ready to generate the output, create a copy of the RoboHelp project that has a glossary you want to update.
- If glossary terms have not been marked then mark glossary terms in the project, you can run the Glossary Hotspot wizard to mark the glossary terms in the topic (glossary terms can be also dragged into the topics directly as well) and drag drop glossary terms into master pages and/or snippets (if you want some marked glossary terms in them too).
Download the script from the link UpdateMarkedGlossaryTerms. Update the GlossaryName and GlossaryStyle variables in the script according to your need (by default the default Glossary is used and the default Glossary style is Tool Tip – look into the script for more details).
- Either Open the script from ExtentScript Toolkit (and select RoboHelp 8 or 9 as target, according to the version installed on your machine).
- Or you can import this script into RoboHelp, in the scripting pod to run it from there.
- Run the script (with ExtentScript Toolkit you can run it by pressing F5 and in the scripting pod you can run by selecting the script and Right click -> Run).
- On generating the output from this project, you will see the glossary as ToolTip or Text pop up as per the GlossaryStyle set in the script.
For FrameMaker-RoboHelp integration users
- After import/update FM link and completing style changes in RoboHelp, when your project is ready to generate output, you should create a copy of your project.
- In this Project copy, set the Glossary generated from FrameMaker as default and run the Glossary Hotspot wizard to mark the glossary terms in the topics generated from FrameMaker.
- Rest steps 4 to 6 will be same as mentioned above.
Limitations of the script
- Glossary definition length for Tooltip cannot be more than 512 characters and for Text Popup it cannot be more than 2025 characters
- Please note that this script will update the content of the project so you need to create a copy of your final project every time and run the script on it to generate output with desired Glossary style as the projects topics/master pages/snippets will get updated
Hope this will be useful for many users who coveted for glossary style in the output as Tool tip or Text popup from a long time and for the scripting geeks this may help them build on other variations, this might also help other users to get an idea regarding how to customize XHTML code and get the desired variations in their output.
Ashish Chandra Gupta