
Copy link to clipboard
Copied
Hi there,
I'm a fairly new user to Robohelp 9.0.2. I'm generating html help from linked Word documents. Quite a few in fact. I'd like somehow automate the build process, where I write a script to open a Robohelp project, update it to reflect the most up-to-date version on the server, and generate the WebHelp output.
I'm having a hard time figuring out how to do this. Does anyone have any recommendations, example scripts, or any suggestions of good places to learn more about scripting in general?
Thanks,
Steve
1 Correct answer
Hi,
There's an example script that does this for FrameMaker files. You should be able to easily modify the script to make it work with Word. See the second to last script on http://www.grainge.org/pages/authoring/scripts/scripts.htm.
If you want some more information on getting started with scripting, check out http://www.adobe.com/devnet/robohelp/articles/robohelp-extendscript.html.
Greet,
Willam
Copy link to clipboard
Copied
Have you checked out this link on Peter Grainge's site?
http://www.grainge.org/pages/authoring/command_line/command_line.htm
Copy link to clipboard
Copied
Hi,
There's an example script that does this for FrameMaker files. You should be able to easily modify the script to make it work with Word. See the second to last script on http://www.grainge.org/pages/authoring/scripts/scripts.htm.
If you want some more information on getting started with scripting, check out http://www.adobe.com/devnet/robohelp/articles/robohelp-extendscript.html.
Greet,
Willam

Copy link to clipboard
Copied
Thanks guys, those are working really well.
On efollow-on questiopn. I've got an SSLManager in the script now, like this:
for(var i = 1; i<=sslmngr.count; i++)
{
var ssl = sslmngr.item(i);
if(ssl.name == 'WebHelp')
{
//ssl.CBT = 'NOT Not_Online'; //this looks to be set on the SSL in the project
ssl.generate();
}
}
If I set the Not_Online CBT in the project in robohelp itself, it works fine. Doing it in the script (uncommented obviously), has no affect. Any ideas?
Thanks,
Steve
Copy link to clipboard
Copied
If I'm not mistaken, setting ssl.CBT will work for every SSL except WebHelp, since WebHelp has Content Categories. The SSL of WebHelp itself has no CBT setting.
I've not used this before, but what I make up from the documentation, you'd have to do something like this (I didn't test the script below):
for(var i = 1; i<=sslmngr.count; i++)
{
var ssl = sslmngr.item(i);
if(ssl.name == 'WebHelp')
{
//Get all content categories
var ducc = ssl.ContentManager;
//Cycle through content categories
for(var j = 1; j<=ducc.count; j++) {
var cc = ducc.item(j);
//Set CBT for content category
cc.CBT = 'NOT Not_Online';
}
ssl.generate();
}
}
Let me know how it works for you.
Greet,
Willam

Copy link to clipboard
Copied
Works a treat Thanks.
Steve
Copy link to clipboard
Copied
Which script did you start with? I'm trying to do the same thing only with FrameMaker source. I can't find any very relevant sample scripts. The ones that come with RoboHelp HTML all seem to be about extending the product's capabilities rather than automating its basic functions.
Copy link to clipboard
Copied
See second to last script on http://www.grainge.org/pages/authoring/scripts/scripts.htm
What exactly are you trying to accomplish? What basic functions would you like to automate?
Greet,
Willam
Copy link to clipboard
Copied
The part I can't find sample code for is generating a WebHelp project. I don't need to set any options.It's the default SSL, so generating the default would be fine, too.
The core of that script is:
RoboHelp.openProject(projectPath); //Open the project
RoboHelp.project.updateAll(false); //Update all linked documents (pass true for Force update)
RoboHelp.quit(); //Quit RoboHelp
I'm looking for something like
RoboHelp.project.generateDefault
or
RoboHelp.project.generateWebHelp

Copy link to clipboard
Copied
Here's a version of what I am using:I think the generate() function at the end is what you want.
Steve
var projectPath = "C:\\scratchpad\\Scratchpad.xpj";
main();
function main()
{
if(projectPath =='')
{
//Error!. Quit RoboHelp
alert("Project path is not defined. \nPlease update the 'projectPath' variable in the script.");
RoboHelp.quit();
}
RoboHelp.openProject(projectPath); //Open the project
RoboHelp.project.updateAll(true); //Update all linked documents (pass true for Force update)
var sslmngr = RoboHelp.project.SSLManager;
for(var i = 1; i<=sslmngr.count; i++)
{
var ssl = sslmngr.item(i);
if(ssl.name == 'WebHelp')
{
var ducc = ssl.ContentManager; //Get all content categories
//Cycle through content categories
for(var j = 1; j<=ducc.count; j++) {
var cc = ducc.item(j);
cc.CBT = 'NOT Not_Online'; //Set CBT for content category
}
ssl.generate();
}
}
Copy link to clipboard
Copied
You really have to iterate through each item? There's nothing that just executes the Generate command with defaults for a specified target?
Copy link to clipboard
Copied
Hi Robert
I think you do that using the Command Line generation option.
Cheers... Rick
Helpful and Handy Links RoboHelp Wish Form/Bug Reporting Form Begin learning RoboHelp HTML 7, 8 or 9 within the day! |
Copy link to clipboard
Copied
What I'm actually looking to automate is the full build process:
- open FrameMaker project, set conditions for PDF, update book, save as PDF, set conditions for online help, update book, save, close
- delete files from Webhelp output directory
- open RoboHelp project, update from FrameMaker, generate WebHelp, close
- copy static files to WebHelp output directory
- .zip WebHelp
- check FrameMaker source, PDF, and .zip into source control
I called Adobe support looking for more information on using FrameScript with RoboHelp. They just pointed me to what I'd found already, had no additional information that might help me, and recommended that I use RHCL instead.
Copy link to clipboard
Copied
Hi,
For generating the default layout:
var layouts = RoboHelp.project.SSLManager;
for(var i = 0; i<= layouts.count; i++) {
var ssl=layouts.item(i);
if(ssl.defaultLayout) {
ssl.generate();
break;
}
}
For the complete automation: Theoretically, you should be able to create a script that controls both FrameMaker and RoboHelp by using Bridge features. But I've only heard that it's possible and I haven't seen example scripts yet
More down to earth, perhaps you can create an FM script and a RoboHelp script. Then use a bat file or something to execute the scripts one after the other.
Copy link to clipboard
Copied
Isn't there something simple and sraightforward along the lines of:
RoboHelp.project.ssl.generate.WebHelp
Iterating through a bunch of SSLs when we use only one makes no sense to me.
I figured from the beginning I'd probably have to hand off between different scripting languages several times. The last step actually has to use Cygwin, but kicking off a Cygwin script from a batch file is simple.
Copy link to clipboard
Copied
If you have only one layout, you can try the following:
RoboHelp.project.SSLManager.item(1).generate();
This kind of statement works in regular JS, so I guess it works in ExtendScript as well. The downside is that it always generates the first layout. When you later decide to add another layout as the default layout, you may need to amend the script. Cycling through the SSL's allows you to define multiple and always generate the default one. Since it's done in a script it takes no time at all so I don't see a problem cycling through the SSL. (And it's easier to read than the above line.)
Greet,
Willam

