Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Promotions
Estimated shipping
Tax
Calculated at checkout
Total
Review and Checkout
Adobe Developer Connection / RoboHelp Developer Center /

Using the new RoboHelp 10 scripting events

by Willam van Weelden

Willam van Weelden

Content

  • Setting up the example script
  • Making script run when event occurs
  • Stopping script from running when an event occurs
  • Available events
  • Scripting for events

Created

29 October 2012

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
content managementextensibilityRoboHelp
Was this helpful?
Yes   No

By clicking Submit, you accept the Adobe Terms of Use.

 
Thanks for your feedback.

Requirements

User level

Intermediate

Required products

  • RoboHelp (Download trial)

Sample files

  • copySkinFiles.zip (3 KB)

RoboHelp 10 introduced a new feature for scripts: events. An event is a specific action that is executed in the RoboHelp application. For example, saving a topic or opening a project are events. With scripting events, you can set scripts to run automatically whenever a certain event occurs.

So why is this great news? Because these events enable you to make the most out of RoboHelp automation. Consider an example: many users have customized WebHelp output. This means that they made thier output files. Whenever WebHelp is generated, they need to paste the modified output files into their output.

Enter events: When WebHelp is generated, RoboHelp automatically runs a script. This script finds the correct output folder and pastes the modified output files into the output.

To illustrate this article, I have created a simple script for this scenario. You can add the script to RoboHelp, and register the script to run whenever a WebHelp output is generated. The script will automatically copy any custom-modified output files into the WebHelp output. Download the script and follow the instructions in this article to set it up.

In this article I will how you how you can register scripts to run when specific events occur and which events are available. I will also show you how you register a script to an event using scripting and which arguments are passed by RoboHelp for each event.

Setting up the example script

Before you can use the example script, you need to tell the script where your custom-modified output files are stored.

  1. Go to the Script Explorer pod. If you don't see it, select View > Pods > Script Explorer.
  2. Click in the empty space inside the pod, and then click the Import button to import the script.
  3. In the import dialog box, choose the script file and click Open.
  4. In the Script Explorer pod, select the script and click the Edit Selected Item button. The script is opened in the ExtendScript Toolkit.
  5. Go to line 14, and add the full path of the location where your modified files are stored between the brackets. Ensure you replace all backslashes in the path by forward slashes. Example:

    this.skinDirectory="C:/temp/SkinFiles"

  6. Save your changes and close the script.

The script is now set up and ready to run.

Note: This example script is very simple and therefore runs on all  WebHelp outputs you create for all your projects. You cannot choose for which projects it should run.

Making script run when event occurs

Before script can work, you need to register script with the correct event. And to register the script, you need to know which function in the script you want to run. Ask the developer of the script about which function RoboHelp must run. For the example script provided, you need the function copySkinFiles.
To register script with event:

  1. Go to the Script Explorer pod.
  2. Right-click the script, and select Register for Event from the context menu. RoboHelp opens the Register Event dialog box.
  3. In the Function Name field, enter the function name that RoboHelp should run.
    Note: Add only the name of the function, and do not add parentheses or arguments to the function name.
  4. In the Eventfield, select the event on which RoboHelp must run the script. For the example script, choose PostSSLGenerate.
Figure 1. The Register Event dialog box.
Figure 1. The Register Event dialog box.
  1. Click OK.

The script is now registered with the event and will run every time after you generate a single source layout. The script will automatically determine whether you’ve generated a WebHelp output. Try generating a WebHelp layout to see how the script works.

Stopping script from running when an event occurs

If you don’t want the script to run when an event occurs, you must unregister the script from the event.

  1. Go to the Script Explorer pod. If you don't see the pod, select View > Pods > Script Explorer.
  2. Click the View Registered Items button. The All Registered Events dialog box appears. It lists all registered scripts.
Figure 2. The All Registered Events dialog box
Figure 2. The All Registered Events dialog box
  1. Select the script that you want to unregister.
  2. Click Unregister.
  3. Click OK.

The script will no longer run when the specific event occurs.

Available events

The events supported by RoboHelp are listed in the table below:

Event Event occurs
closeTopic

When a topic is closed

openTopic When a topic is opened
preImport Before a file is imported
postImport After a file is imported
postSSLGenerate After an SSL is generated
Note: When you have an SSL with multiple content categories, this event is fired for every category.
preSSLGenerate Before an SSL is generated
Note: When you have an SSL with multiple content categories, this event is fired for every category.
preWordDocUpdate Before a linked Word document is updated
postWordDocUpdate After a linked Word document is updated
preFrameMakerDocUpdate Before a linked FrameMaker document is updated
postFrameMakerDocUpdate After a linked FrameMaker document is updated
SaveAll When the Save All button is clicked
postTopicUpdate After a topic is updated
preImportPDFComments Before importing PDF review comments
postImportPDFComments After importing PDF review comments
preCreateReviewPDF Before creating a PDF review document
postCreateReviewPDF After creating a PDF review document
openProject When a project is opened
preCloseProject Before a project is closed
postSOpenProject After a project is closed

Scripting for events

(This section is only for users who want to create scripts.)

You can also register and unregister scripts to events using scripts themselves. For this, the RoboHelp object supports the following three methods:

RoboHelp.registerEvent(eventname:string, filename:string, function to run:string); RoboHelp.isEventRegistered(eventname:string, filename:string, function to run:string); RoboHelp.unregisterEvent(eventname:string, filename:string, function to run:string);

The method registerEvent registers a script to an event, while the method unregisterEvent unregisters the script. Both the methods return a Boolean value to indicate whether the script was successfully registered or unregistered.

The method isEventRegistered checks whether a script is already registered to an event. This method returns true when the script is registered and false when the script is not registered.
The first and third parameters of the new methods are easy to understand: the name of the event you want to register the script with and the name of the function you want to run when the event occurs.

For the second parameter, you need to know the full path of the file that contains the script you want to register. Luckily, ExtendScript provides a method for getting the file name of the current script: $.fileName.

Therefore, to register the function copySkinFiles in the current script file to the event PostSSLGenerate, you can use the following command:

RoboHelp.registerEvent('PostSSLGenerate', $.fileName, 'copySkinFiles');

Available arguments for scripting

Most scripting events supply an argument when the script is run. The argument provides details of the event occurred.

The table below lists the arguments that are available when a specific event occurs:

Event Argument passed to the function
closeTopic The full file path of the topic closed from the WYSIWYG editor
openTopic The full file path of the topic opened in the WYSIWYG editor
preImport The full path of the file being imported
postImport The full path of the file that was imported
preSSLGenerate The name of the SSL being generated
postSSLGenerate The name of the SSL that was generated
preWordDocUpdate The full file path of the Word document that is being updated
postWordDocUpdate The full file path of the Word document that was updated
preFrameMakerDocUpdate The full file path of the FrameMaker document that is being updated
postFrameMakerDocUpdate The full file path of the FrameMaker document that was updated
SaveAll None
postTopicUpdate None
preImportPDFComments The full file path of the topic in which the comments are being imported
postImportPDFComments The full file path of the topic in which the comments were imported
preCreateReviewPDF The full path of the topic being added to the review PDF
postCreateReviewPDF The full path of the topic that was added to the review PDF
openProject The full path of the project XPJ file
preCloseProject The full path of the project XPJ file
postOpenProject The full path of the project XPJ file

Where to go from here

Be sure to read my previous article on Getting started with ExtendScript in RoboHelp. Here are some more scripting resources:

  • http://www.wvanweelden.eu/product-category/extendscript
  • http://www.wvanweelden.eu/premium-content/robohelp-extendscript-library
  • http://www.grainge.org/pages/authoring/scripts/scripts.htm

More Like This

  • Getting started with ExtendScript in RoboHelp
  • Integrating RoboHelp 9 projects with Perforce
  • Adobe AIR Help in RoboHelp 9
  • Integrating RoboHelp projects with Team Foundation Server
  • Use of RoboHelp Server by technical publications departments
  • Creating ebooks using RoboHelp 9

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement