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().
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
...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
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.
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
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
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.
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
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.
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
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();
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();
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
Copy link to clipboard
Copied
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.