The following script, while executing, imports a FrameMaker
document to a RoboHelp project. Open a FrameMaker document before
executing the script. The script automatically launches RoboHelp.
doc=app.ActiveDoc
var path=doc.Name;
createScript(path)
function createScript(path)
{
script="doc.importFrameMakerDoc (\""+path+"\",\"\",\"\", \"\", false, \"\", \"\");";
sendRoboHelp(script);
}
function sendRoboHelp(script)
{
var bt = new BridgeTalk();
bt.target = "RoboHelp";
bt.body = script;
bt.send();
}
Using the
doc
variable, create a reference to
the active FrameMaker window. Use the
Doc.Name
property
to get the path of the active FrameMaker window. Call the user-defined
createScrip()
function
by passing the path variable. In the function, create the following
string:
script="doc.importFrameMakerDoc (\""+path+"\",\"\",\"\", \"\", false, \"\", \"\");";
doc.importFrameMakerDoc
is a RoboHelp function
that takes the following parameters to import a FrameMaker document
to RoboHelp:
-
File path
-
Folder name
-
FrameMaker TOC file path
-
TOC name
-
Add index to topics
-
Index name
-
Glossary name
The example uses default settings
to import the document to RoboHelp. Provide document’s path. Provide
false
for
the Add Index to Topics parameter. As a general JavaScript rule,
the quotes in a string are provided inside the escape character
“
\
”. The user-defined
sendRoboHelp()
function
invokes RoboHelp. Create a new
BridgeTalk
object
which is used to connect to a different application in Technical
Communication Suite. Using the
target
property,
provide the name of the application on which you want to run the
script. Use the
body
property to provide the script
that you want to run. The
send()
method sends the
script to the target application and executes the script.