31
Automation Interface, Add-Ins and Tools / Re: Document Script gives "expected ';'" Error
« on: January 07, 2016, 12:09:50 am »
Thanks for the pointers Geert! I'd started that way, and then just kept trying every option I could think of to get the trivial example to work.
As you suggested, I moved the code into the "Dummy" script that was referenced in the drop down, and called it from the Custom Fragment as you'd suggested.
There was an error in the change I made too, as I'd missed a parameter from the InsertText field, which caused a "type mismatch" error.
The following code worked:
At least, with your help, I've got the trivial example to work now, which is a major step forward.
Sadly, the code I was intending to use seems to cause EA to crash and shutdown.
As you suggested, I moved the code into the "Dummy" script that was referenced in the drop down, and called it from the Custom Fragment as you'd suggested.
There was an error in the change I made too, as I'd missed a parameter from the InsertText field, which caused a "type mismatch" error.
The following code worked:
Code: [Select]
!INC Local Scripts.EAConstants-JScript
function main()
{
Session.Output("Got here!");
var reporting as EA.DocumentGenerator;
reporting = Repository.CreateDocumentGenerator();
if(reporting != null)
{
Session.Output("Got here 2!");
if(reporting.NewDocument(""))
{
Session.Output("Got here 3!");
if(!reporting.InsertText("This is some text",""))
{
Session.Output( "Error: " + reporting.GetLastError() );
}
Session.Output("Got here 4!");
var retStr;
retStr = reporting.GetDocumentAsRTF();
Session.Output("Got here 5!");
return retStr;
}
}
}
At least, with your help, I've got the trivial example to work now, which is a major step forward.
Sadly, the code I was intending to use seems to cause EA to crash and shutdown.
