I am trying to run an Extendscript script in RH10.0.1.292.
This script is registered to the PostFrameMakerDocUpdate event so that it runs evey time I update my FM sources.
Every time I Update or Force Update, when the script runs, I get an 'undefined variable' message.
However, when I run the same script from within RoboHelp, or from the ExtendScript Toolkit, everything is fine. The script runs to completion without any errors.
Initially, the undefined variable is a global (defined at the top of the file before any functions)
var Rev = "Rev 2.3 December 22, 2013";
If I move Rev into the only function where it is used, I get another error: the numParaStyles is now an undefined variable. This is a local variable, defined in the one and only function where it is ued.
var numParaStyles = FM_paragraphStyles.length;
Although FM_paragraphStyles is a global array:
var FM_paragraphStyles = ["TipText", "CautionText", "WarningText"];
This script is is based on the Reference Page Image Updater.jsx script included in the
Adobe\RoboHTML\10.00\Scripts\Sample Scripts
folder. I added the Rev string as part of my debugging efforts,
Since the script works find from the ExtendScript Toolkit and from within RoboHelp, I suspect something is happening to mess up with the script's variable scoping when the script is run in response to an event. But that's just a guess. I am not an expert in JavaScript, let alone ExtendScript.
Has anyone else seen this behavior? Is there something I can do to prevent the error messages?
Thanks!