Hi,
Has anyone figured out how to correctly use Python with the IESRIScriptEngine in .NET? The documentation isn't particularly detailed. Through guesswork, I've come up with this:
Dim pointer(1) As IntPtr
pointer(0) = Runtime.InteropServices.Marshal.AllocHGlobal(4)
Dim engine As IESRIScriptEngine = New ESRIScriptEngine
With engine
.Language = "python"
.AddCode("import arcpy")
.AddCode("mxd = arcpy.mapping.MapDocument(""CURRENT"")")
.AddCode("mxd.dataDrivenPages.currentPageID = " & id)
.Run("", pointer)
End With
This code runs if you encapsulate it in a Try/Catch block, but the pointer isn't working, which means it throws an error every time it runs. Not a major problem in this instance, but it means I can't get any variables passed back from the script.
Any ideas?
Thanks!
Roland.