Peter Grainge wrote:
I believe Adobe's site has two manuals that cover ExtendScript.
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."
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.
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.