Skip navigation
Currently Being Moderated

master ExtendScript to run FrameMaker and RoboHelp scripts?

Apr 18, 2012 11:02 AM

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_aut omation\\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().

 
Replies
  • Currently Being Moderated
    Apr 18, 2012 11:54 PM   in reply to rlauriston

    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-A91 A-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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 20, 2012 6:33 AM   in reply to rlauriston

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 23, 2012 11:57 AM   in reply to rlauriston

    Not that I know. But I was thinking along the lines of running the script in FM, then writing a batch file in ExtendScript that launches RH and the script that should be run.

     

     

     

    Greet,

     

     

     

    Willam

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 23, 2012 12:39 PM   in reply to rlauriston

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 23, 2012 10:30 PM   in reply to rlauriston

    Indeed.when the file exists you can skip the step. But you have to be sure that the bat file contains the correct commands.

     

     

     

    Greet,

     

     

     

    Willam

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points