• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

master ExtendScript to run FrameMaker and RoboHelp scripts?

Contributor ,
Apr 18, 2012 Apr 18, 2012

Copy link to clipboard

Copied

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().

Views

2.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 23, 2012 Apr 23, 2012

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 mistake

...

Votes

Translate

Translate
LEGEND ,
Apr 18, 2012 Apr 18, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 19, 2012 Apr 19, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2012 Apr 20, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 20, 2012 Apr 20, 2012

Copy link to clipboard

Copied

Thanks. I already asked that question over there, but maybe it was buried in a more general question. I asked again: http://forums.adobe.com/thread/992890

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 23, 2012 Apr 23, 2012

Copy link to clipboard

Copied

"... 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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 23, 2012 Apr 23, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 23, 2012 Apr 23, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 23, 2012 Apr 23, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 23, 2012 Apr 23, 2012

Copy link to clipboard

Copied

Thanks! This works:

var myfile = new File("C:\\test\\test.bat");

var content = "C:\\Progra~2\\Adobe\\adober~1\\RoboHTML\\robohtml -x C:\\test\\2_robohelp.jsx";

myfile.open("w");

myfile.write(content);

myfile.close();

myfile.execute();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 23, 2012 Apr 23, 2012

Copy link to clipboard

Copied

Now I get it. fileObj is the object type to use when setting a variable to a file. If the batch file c:\test\test.bat already exists, all I need is:

var myfile = new File("C:\\test\\test.bat");

myfile.execute();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 23, 2012 Apr 23, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 24, 2012 Apr 24, 2012

Copy link to clipboard

Copied

LATEST

Yes, and for a script that was going to be reused in various contexts generating the batch file might be a better choice. In this case, I already had the batch file working, and it contains additional commands that are executed after the RoboHelp script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp