Copy link to clipboard
Copied
Dear friends and experts,
I can run without problems any of my installed FMs (6 ... 13). The last installed was FM 13 aka 2015.
In all FMs since version 10 I can run scripts - but have no clue which ESTK they are using.
On drive C I find ExtendScript Toolkit CS4, ...CS5 and ...CS6. They have been installed with the various FMs
When testing my script (developing in FM12) in FM 10 or 11 I get an error on line 11: undefined is not an object
Which cure might be necessary to run the script also in older FMs?
function CreateBibDoc () {
// ----------------------------------------------- create new doc from template and fill it
// returns created doc in function
giLvlTrace += 1; ZTrace ("CreateBibDoc");
var j, uniqueCitations= [], nUnique, nItems, insText, newDoc, pgf, textloc, j;
var writeFile = GetDocPath () + gsCollectFile;
// create array of unique citations and place them in the doc
uniqueCitations = SortUnique (gasFndCitations);
nUnique= uniqueCitations.length;
// createa new file
newDoc = OpenTemplate (); // FM-10/11 error FM-12/13 OK
pgf = newDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf; // get first pgf in flow
for (j = 0; j < nUnique; j += 1) {
textLoc = new TextLoc (pgf, 0);
insText = uniqueCitations;
newDoc.AddText (textLoc, "[["+insText+"]]"+ "\x08" + "{"+insText+"}"); // \t inserts a NL...
if (j < nUnique -1){
pgf = newDoc.NewSeriesPgf(pgf); // add a paragraph
}
}
giLvlTrace -= 1;
return newDoc;
} // --- end CreateBibDoc
function OpenTemplate () {
// ----------------------------------------------- Open template file
// return the Open file in the function
giLvlTrace += 1; ZTrace ("OpenTemplate");
var tplDir, tplFile, openParams, openReturnParams, oFile;
tplDir = GetScriptPath ();
tplFile = tplDir + "\\" + gsTemplate;
// oFile = SimpleOpen (tplFile, true); // Opens the dir of the active document
openParams = GetTplParams ();
openReturnParams = new PropVals();
oFile = Open (tplFile, openParams, openReturnParams);
giLvlTrace -= 1;
return oFile;
} // --- end OpenTemplate
Copy link to clipboard
Copied
Hi Klaus,
I usually get this error when trying to run a script while it's open in ESTK and "Extendscript Toolkit CSx" is by mistake selected as the target application instead of FM.
HTH,
Roman
Copy link to clipboard
Copied
Regarding Roman's response, you can add this to the top of your scripts to force the ExtendScript Toolkit to use the FrameMaker engine.
#target framemaker
-Rick
Copy link to clipboard
Copied
Hi Rick,
BTW, for some reason, when a script is open in ESTK, this line does not change the target app to FM, as if ESTK ignores it.
Best regards,
Roman
Copy link to clipboard
Copied
Rick, Roman: Thank You for answers. However...
The #target instruction has no influence in my environment. As stated in various posts I can not run scripts from the ESTK. ESTK reports a "missing link".
For example in FM-11 I get this error when first opening ESK with File > Scripts > New Script…, then opening the script in ESTK and run it.
I get the same error when trying to do so with FM-12 or FM-13:
Hence I have the script open in my editor (EditPad Pro 7), save it. Then in FM I open the script catalgoue, refresh and run the script.
IMHO the current problem is in the FM-10/11 engine. But I do not undestand the connection between FM ($HOME\ExtendScript.DLL) and C:\Program Files (x86)\Adobe\Adobe Utilities - CS6\ExtendScript Toolkit CS6 (which reports ESTK version 3.8.0.12).
On my wife's mini-PC (small screen, slow) with only 1 FM version installed, I can run scripts with ESTK . But I need to test in various FM versions ...
Probably this ESTK version is to high for FM-10/11 (for the current problem) and I must find means to test with the lower versions (CS5: 3.5.1.59; CS4: 3.0.0.41). Unfortunately I have no success with virtual machines - they are awfully slow on my machine (ThinkPad T400 with docked peripherals). So my test environment may not be clean enough.
Copy link to clipboard
Copied
I have found the source of the problem:
In OpenTemplate I open an FM12 file - there is no adeaquate error-handling for this
j = GetPropIndex(params, Constants.FS_FileIsOldVersion);
params.propVal.ival = Constants.FV_DoOK;
So my problem is solved! Thanks for listening!