


The For-Loop to: for /F "delims=" %%a in ('mshta.exe "%~F0"') do (Īt myFunction i inserted: var y = document.getElementById("try"). Var fso = new ActiveXObject("Scripting.FileSystemObject") Ī demonstration of how to access a Text FieldĬlick the "Login" button to get the text in the text field.īut with two input texts it does not work. Var x = document.getElementById("myText").value In a word, it works with the following code: I want to read two words and pass them to the batch. which can be anything, but must be uniqueĮle.value = arg1 //arg1 is from above code "theTextFieldID" is the element's ID attribute value, var ele = document.getElementByID("theTextFieldID") get a reference to the element's object, then change its value. Setting a text field value is same as in web browser. retrieving the first argument (whatever that it) var arg1 = WSCript.Arguments(0) The first argument of mshta.exe following the HTA file. WScript.Arguments(0) is the first argument.

Parameters of the HTA file can be retrieved using the WScript.Arguments property. The batch file in that post, runs mshta.exe as a command line for the for command. 1 I want to create a HTA that uses a batch file, when a user fills in the textboxes it will pass the data to the batch file. Passing batch variable values to the JScript context of the HTA, is a matter of passing command line arguments to mshta.exe. It's looks and works the same as JavaScript, but it's not identical. JScript is Microsoft's version of JavaScript.
