Copy link to clipboard
Copied
I have started learning ExtendScript via what appears to be the standard method -- trial and error. I want to get a list of all the topics that are open in the Design or HTML editors -- particularly the topic which currently has focus. Is there any way I can discover this through the RoboHelp object or its derivatives?
Copy link to clipboard
Copied
I believe Adobe's site has two manuals that cover ExtendScript.
See www.grainge.org for RoboHelp and Authoring tips
Copy link to clipboard
Copied
Peter Grainge wrote:
I believe Adobe's site has two manuals that cover ExtendScript.
True. (Actually scattered amidst the Adobe site are more than two manuals that cover ExtendScript, but only two that appear to be directly relevant here). The first is the "JavaScript Tools Guide," advertised as being part of Creative Suite 5, but which also appears to have relevancy to RoboHelp as well. This guide describes the usage of the Adobe ExtendScript Toolkit (a development environment in the same category as Microsoft's Visual Studio or Eclipse) and documents a few objects, methods and attributes not part of the base JavaScript language but added to Adobe's implementation. While generally useful, nothing here is specifically applicable to the use of ExtendScript in RoboHelp.
The second document is the "RoboHelp 8 Scripting Guide." This particular manual contains virtually no information about ExtendScript in general, but it does purport to document the entire Document Object Model implemented inside RoboHelp, giving one access to all the pieces of a RoboHelp project.
Nowhere in this second manual have I found any object or method which says (for example), "RoboHelp.shell.editor.getTopicName() returns the name of the topic which currently has focus in the editor." It's possible that the function simply doesn't exist, it's possible that it is documented and I just don't understand the acronyms or jargon used in the document, or it's possible that the function exists and is simply undocumented (I've already discovered features of the RoboHelp DOM which are not documented).
It's also possible that if the answer is there, I might be able to use the ExtendScript reflection interface to ferret it out. However, I'd much rather get the answer through a means other than reverse-engineering (which, you must admit, is a very expensive process). I'm hoping someone else who's needed to do this can chime in and say, "Yes, this is the object/method to use", or "No, it's not built into the DOM, but you can save settings to a file and then retrieve them (maybe the MRU list?)", or some Adobe engineer could say "Nope, we didn't provide any interface to that information. So sorry."
Copy link to clipboard
Copied
I ran into the same problem and had to come up with a convoluted workaround. I was trying to run a script that performed an action on the topic with the current focus. But I couldn't ever figure that out.
You can cycle through all the project's topics using TopicManager object and then manipulate a specific topic using an index number. That's how I had to do it.
In my script, I ended up asking the user to type a string in a prompt then the script found a topic filename containing that string and then performed the operation on that file.
Copy link to clipboard
Copied
Unfortunately, there is no way to get which topic has focus. But with the new RoboHelp 10 scripting events you can run a script whenever a topic is openend or closed. The full file path of the topic is given as an argument, so you can automatically perform the actions you need.
See http://www.adobe.com/devnet/robohelp/articles/robohelp10-scripting-events.html for an introduction.
Greet,
Willam