Skip to main content
Inspiring
April 18, 2012
Answered

master ExtendScript to run FrameMaker and RoboHelp scripts?

  • April 18, 2012
  • 1 reply
  • 2533 views

I'm trying to automate generation of PDF in FrameMaker 10 and WebHelp from the same source in RoboHelp 9.

I have two scripts that are working, now I'm trying to run them as a single script.

Looking at a discussion about InDesign scripting (http://forums.adobe.com/thread/776832), I thought maybe the following would work:

robohelp.executeScriptFile("c:\\Users\\rlauriston\\Documents\\help_automation\\2_robohelp.jsx")

but when I debug it in ExtendScript Toolkit CS5.5, I get "robohelp is undefined".

Reading Adobe Creative Suite 5 JavaScript Tools Guide, I get the impression that this should work:

robohelp.executescript(

var projectPath = "C:\\Users\\rlauriston\\Documents\\My RoboHelp Projects\\AG\\SentrionAdminGuide.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)

          RoboHelp.closeProject(); //Close project

        RoboHelp.quit(); //Quit RoboHelp

}

)

but when I debug it I get "Illegal use of reserved word 'var'". If I move the var declaration to the top of the file, I get "Expected: )" on the semicolon after main().

This topic has been closed for replies.
Correct answer Willam van Weelden

I've got the two scripts, and I could use robohelp -x <script> to launch the second one, but I can't figure out how to chain them.

In the Creative Suite 5 JavaScript Tools Guide, it says that fileObj.execute() "Opens this file using the appropriate application, as if it had been double-clicked in a file browser. You can use this method to run scripts, launch applications, and so on." So it ought to be possible to have the FrameMaker script start a batch file that launches the RoboHelp script, but I can't find a sample script that does that, nor can I figure out from the documentation how to specify fileObj.

Also, using the ExtendScript Toolkit CS5.5 Object Model Viewer, I can't find an execute() function.


Hi,

For working with fileObj, you first need to create a file object.

//Create bat file object

var mybat = new File(“C:/mybatfile.bat”);

//Create content

var content = “\ndel /F /! \”” + mybat.fsName + “\””;

//Write content to bat file

mybat.open(“w”);//This will open for writing and create if not exists

mybat.write(content);

mybat.close();

//Run the bat file

mybat.execute();

If you want more examples, check the ePub generation script in RoboHelp 9. That uses the function writeFile (if I’m not mistaken) to write to a file.

Greet,

Willam

1 reply

Willam van Weelden
Inspiring
April 19, 2012

As far as I can make out, everything after robohelp.executescript is considered an argument for the function executescript. Opening RoboHelp and run a script, see http://help.adobe.com/en_US/robohelp/robohtml/WS98613C7C-EF5B-48e9-A91A-D2AABB882687.html

For running both applications from a single script, I’ve been told you can use the Bridge features. But I’ve never seen an example of that.

Greet,

Willam

Inspiring
April 19, 2012

There's no framemaker.exe -x [scriptfilenames], is there?

Odd that there's no sample code, given how much time and effort Adobe clearly put into creating and sort-of documenting those cross-application features.

Inspiring
April 23, 2012

I have absolutely no idea as I haven’t used FM scripting. You will probably have better luck asking this on the FM forum: http://forums.adobe.com/community/framemaker

But you could write a script you run in framemaker that starts RoboHelp with the script you want to run.

Greet,

Willam


"... you could write a script you run in framemaker that starts RoboHelp with the script you want to run."

Is there a sample script somewhere that does that? I haven't been able to find one.