Javascript version would be more like this:

function Test() {
  var shell = new ActiveXObject("WScript.Shell");
  var exec = shell.Exec("ipconfig /all");
  var text = exec.StdOut.ReadAll();
  var lines = text.split("\n");
  for (var i=0; i<lines.length; i++) {
    logAddLine(lines[i]);
  }
} 


Or, if you want to make it easier:


if (typeof(logAddText) != 'function') {
  function logAddText(text) {
    var lines = text.split("\n");
    for (var i=0; i<lines.length; i++) {
      logAddLine(lines[i]);
    }
  }
}
function Test() {
  var shell = new ActiveXObject("WScript.Shell");
  var exec = shell.Exec("ipconfig /all");
  logAddText(exec.StdOut.ReadAll());
}


Alternatively:


function Test() {
  var shell = new ActiveXObject("WScript.Shell");
  var exec = shell.Exec("ipconfig /all");
  var stdOut = exec.StdOut;
  while (!stdOut.AtEndOfStream) {
    logAddLine(stdOut.ReadLine());
  }
}


-- 
<http://forum.pspad.com/read.php?2,43857,43863>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem