This is a follow up to my previous question on executing javascript from VB6 (not .NET) defined in a document variable called "jsMain".
I've tried quite a few approaches and none seem to do what I need.
I even set the .disclosed property to true as well.
I've tried the following approaches and many variations:
FormVariableName = "$form"
Set objNode = Nothing
Set objNode = jsObject.xfa.resolveNode(FormVariableName)
ReturnValue = objNode.jsMain.myInsertPage(sFormName, lPageNumber)
FormVariableName = "$form.#variables[0]"
Set objNode = Nothing
Set objNode = jsObject.xfa.resolveNode(FormVariableName)
ReturnValue = objNode.jsMain.myInsertPage(sFormName, lPageNumber)
ReturnValue = jsObject.xfa.form.jsMain.myInsertPage(sFormName, lPageNumber)
ReturnValue = jsObject.xfa.myInsertPage(sFormName, lPageNumber)
ReturnValue = jsObject.jsMain.myInsertPage(sFormName, lPageNumber)
You have an interesting problem, accessing the xfa structure through the JSO. The JSO exposes the entire Acrobat DOM, however it is limited by the types that can be passed back and forth between VB and JavaScript. There are some obvious incompatibilities here. Incompatibilities that might require special support in the JSO, such as the XFA node objects. VB also has problems with JS names that look like keywords in VB, such as "Form".
I was able to write a VB program that calls your functions by using the Acrobat 8 IAC object. I didn't try with earlier version so I don't know that they don't work, but the 8 object did work with the following code called from a button in the VB6 program. Note that the code resolves the "Variables" node all the way down so that there are no intervening nodes when the function call is made. It would not work otherwise. Note also that the function call is made explicitly with the "Call" statement.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script