Event support in scripting

Use events in scripts to invoke functions at specific trigger points defined in RoboHelp.

Predefined events

The following events are predefined in RoboHelp:

Event

Description

Argument

SaveAll

Sends notification when File > Save All is executed

None

OpenTopic

Sends notification when a file is opened in the editor

Full path of the file

CloseTopic

Sends notification when a file is closed in the editor

Full path of the topic

PreSSLGenerate

Sends notification before an SSL is generated

Name of the layout

PostSSLGenerate

Sends notification after an SSL is generated

Name of the layout

PreImport

Sends notification before a file is imported

Full path of the file being imported

PostImport

Sends notification after a file is imported

Full path of the imported file

note:    Event names are not case-sensitive.

Register a function for an event

You can register a function defined in a script for an event from the Script Explorer pod or by modi­fying the script. When multiple functions are registered for the same event, RoboHelp runs the func­tions in the order in which they have been registered.tip:   You can break the chain of execution of functions registered for the same event by changing the return value of a function to false.

Register using the Script Explorer pod

1)Select the script in the Script Explorer pod. Right-click and choose Register For Event.

2)In the Register Event dialog box, specify the function name that you want to register and select an event name from the Event Name list.

note:    Make sure that you specify the function name as it is defined in the script. Event names are predefined in RoboHelp. For example, the SaveAll event runs when you choose File > Save All.

3)Click OK.

Register through a script

Use the following syntax to register a function to an event:

registerEvent (EventName:string, FilePath:string, FunctionName:string)

note:    You can specify arguments with an event to retrieve information that you can use for processing. For example, you can retrieve the filename in an import operation.

Unregister a function

Unregister using the Script Explorer pod

1)Select the script in the Script Explorer pod. Right-click and choose Unregister.

Unregister through a script

Use the following syntax to register a function:

unregisterEvent (EventName:string, FilePath:string, FunctionName:string)


September 30, 2016

Legal Notices | Online Privacy Policy