OK,
I got it to work on my dev box using the following code but when I run it from our production server nothing happens. I don't really work with jscript so I'm not even sure where to begin debugging.
Here is the relevant code
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ProcId As Integer
Dim Proc As System.Diagnostics.Process
ProcId = Shell("cscript \\franklin\c$\Inetpub\wwwroot\shared\Infopath\jscript.js 8275")
Proc = System.Diagnostics.Process.GetProcessById(ProcId)
Proc.WaitForExit(3000)
End Sub
And this is the js file called from above
if(WScript.Arguments.count()==1)
{
var param1 = WScript.Arguments.Item(0);
}
//Start the application
var oApp = new ActiveXObject("InfoPath.Application");
WScript.Echo("InfoPath Version: " + oApp.Version);
//Open an InfoPath document from the published template
var oXDocumentCollection = oApp.XDocuments;
var oXDocument = oXDocumentCollection.NewFromSolution("http://franklin/shared/infopath/Metro Sales MA.xsn");
// Get pointers to the target fields
var oID = oXDocument.DOM.selectSingleNode("//my:PlanId");
//Determine whether the xsi:nil attribute is set for this
//element. If so, remove the xsi:nil attributes so that
//the value can be set.
if (oID.getAttribute("xsi:nil"))
oID.removeAttribute("xsi:nil");
//Update the fields
oID.text = param1;
//Submit the Form
//oXDocument.Submit();
oXDocument.QueryAdapter.Command = 'SELECT * FROM vwMaPlanForReport WHERE PlanId = ' + param1;
//execute "dbo"."byroyalty" ' + percentageValue;
//Query the Data Source.
oXDocument.Query();
oXDocument.DataObjects["Detail"].QueryAdapter.Command = 'execute "dbo"."ps_Reports_MA_Detail_Summary" ' + param1;
//'SELECT * FROM vwMaPlanEquipmentDetail WHERE PlanId = '
oXDocument.DataObjects["Detail"].QueryAdapter.Query();
//Close up shop
oXDocumentCollection = null;
//oApp.Quit();
oApp = null;