User Tools

Site Tools


Sidebar

start

RoboHelp ExtendScript Library

The RoboHelp ExtendScript Library is a library with many useful functions and methods to help you create scripts for RoboHelp. With this library you can focus on what your scripts need to do rather than creating methods for handling common tasks. This RoboHelp ExtendScript Library is the basis of all scripts offered through Help Essentials.

This library is free to use, but it also without warranty of any kind. If you need help using the library, don't hesitate to contact me.

The RoboHelp ExtendScript library was last updated on: 02-04-2018

Get the libray: RoboHelp ExtendScript Library on HelpEssentials

Install the Library

Before you can use the RoboHelp ExtendScript library, you need to install the library on your computer. You need to copy all the library files to a location on your computer, such as C:\ExtendScriptLib. Make sure that all the files are copied to the same directory.

Configure Library for 7-Zip

The library contains functions to zip and unzip an archive using 7-Zip. If you want to use 7-Zip for archiving and extracting, you need to configure the library to use it.

Note: RoboHelp has its own zip function RoboHelp.createZipFile(). This method was added after this library was created. The 7-Zip option has more features but the default RoboHelp solution will work for most.

  1. Ordered List ItemDownload and install 7-Zip
  2. Open the file lib.jsxinc with Notepad++ or a different code editor
  3. Go to the global variable v7Location
  4. Add the complete path to the 7-Zip executable. Example:

    var v7Location = 'C:\\Program Files\\7-Zip\\7z.exe'
  5. Save your changes

Using the Library

In order to use the RoboHelp ExtendScript Library in your scripts, you need to reference the library in your scripts. You can load the library at any time during script execution.

To load the library in your script, add the following line:

#include "<path to library>/lib.jsxinc"

Example:

#include "C:/ExtendScriptLib/lib.jsxinc"

You can now use the variables, functions and methods of the library in your script.

RoboHelp Scripting Events

When you are using RoboHelp scripting events, you need to intiallise the library before you can use all methods and features. To initialise the library, rund the function libInit() as soon as your function is called by the event:

function runOnEvent(parameter) {
   //Initialize the library.
   libInit();
   
   //Your script starts here after the library is loaded
}

The library contains methods and functions that allow the same actions. The functions are always available, even if you don't initialise the library. The following can be run wihout initialising the library:

var file = new File("C:/temp/file.txt");
var content = readFile(file);

If the library is initialised as shown above, you can also run:

var file = new File("C:/temp/file.txt");
var content = file.readFile();

Looking for an introduction to RoboHelp scripting events? Check out these resources:

start.txt · Last modified: 2018/04/02 12:04 by Willam van Weelden