Here is what I have used successfully before.
This allows for the parmeters to be passed on the command line. A couple things to watch out for is that you may have to specify your path to infopath or run this in the same folder. Also If you do not have the exact amount of variables it wont work. So if you only need one variable eliminate the others in the script.
//myscript.js
//parse parameters
if(WScript.Arguments.count()==3)
{
var param1 = WScript.Arguments.Item(0);
var param2 = WScript.Arguments.Item(1);
var param3 = WScript.Arguments.Item(2);
}
//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://insideen/sites/hrs/am/workflow/forms/template.xsn");
oXDocument.DOM.setProperty("SelectionNamespaces", "xmlns:dfs='http://schemas.microsoft.com/office/infopath/2003/dataFormSolution' xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-04T22:36:39'");
// Get pointers to the target fields
var oNum = oXDocument.DOM.selectSingleNode("//dfs:myFields/my:Header/my:ActionID");
var oName = oXDocument.DOM.selectSingleNode("//dfs:myFields/my:Header/my:EmpName");
var oJob = oXDocument.DOM.selectSingleNode("//dfs:myFields/my:Header/my:JobTitle");
//Update the fields
oNum.text = param1;
oName.text = param2;
oJob.text = param3;
//Submit the Form
//oXDocument.Submit();
//Close up shop
//oXDocumentCollection = null;
//oApp.Quit();
//oApp = null;
You would not assign your node to the namespace I think is your issue. You need to define a variable linked to the field and then set the value of that field.
You should be able to add your query command and you see that this script has a submit and close commands commented out.
So the form is left open ready for additional use when it is done.
Have Fun.