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

Is there a way I can call a python script from within a Robohelp script?

New Here ,
Dec 18, 2013 Dec 18, 2013

Copy link to clipboard

Copied

Hi,

I want to integrate an external python script into the current extendscript I use in RoboHelp 10.  Is there a way to do that?

Thanks,

Lauren

TOPICS
Classic , Scripting

Views

1.8K

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 ,
Dec 19, 2013 Dec 19, 2013

Copy link to clipboard

Copied

You can use the command line to call any kind of external application.

Personally, I use the following function to create bat files to do such

work.

I've taken these functions from my free RH Extendscript library -

http://www.wvanweelden.eu/product/robohelp-extendscript-library

function ExecuteBatchFile(command, waitforbatch) {

     if(string_isEmpty(command))

         return false;

     if(!waitforbatch) {

         if(waitforbatch != false) {

             waitforbatch = true;

         }

     }

     var path = Folder.appData.fsName + '/';

     var batFileName = 'ExtendScriptBatchFile';

     var batFileExtension = '.bat';

     var batFile = new File(pathbatFileNamebatFileExtension);

     if(batFile.exists) {

         var i  = 0;

         while(batFile.exists) {

             i++;

             batFile = new File(pathbatFileNamei+batFileExtension);

         }

     }

     command+= "\ndel /F /Q \"" + batFile.fsName + "\"";

     writeFile(batFile, command, false);

     if(!isFile(batFile, true))

         return false;

     batFile.execute();

     /* Wait on batch file execution if needed */

     if(waitforbatch) {

         while(batFile.exists) {

             msg(".");

             $.sleep(100);

         }

     }

     return true;

}

function writeFile(file, szOutput, encoding) {

     var szFilePath = file.fsName;

     if(!encoding || encoding == true) {

        encoding = "UTF-8";

     }

     var fileObj = new File(szFilePath);

     fileObj.encoding = encoding;

     fileObj.open("w");

     fileObj.write(szOutput);

     fileObj.close();

}

Kind regards,

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
New Here ,
Dec 23, 2013 Dec 23, 2013

Copy link to clipboard

Copied

William,

I am not all that familiar with Javascript or extendscript.  Can you provide a link to something that provides more detail about using the command-line?

Thanks,

Lauren

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 ,
Dec 26, 2013 Dec 26, 2013

Copy link to clipboard

Copied

LATEST

For the function mentioned above, create a string with the cmd command:

var cmd = "python -myparameters"

ExecuteBatchFile(cmd, true);

Just make sure to make the functions of my previous post available in

your script.

Kind regards,

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
Resources
RoboHelp Documentation
Download Adobe RoboHelp