title: JScript/CScript promise
body: <p>I am currently trying to run Q promise library from JScript/CScript from command prompt. But it seems that JScript is throwing an error when it tries to execute/eval the code.</p>
  
  <p>Code:</p>
  
  <pre><code>function createXMLHTTPObject() {
  var XMLHttpFactories = [
      function () {return new XMLHttpRequest()},
      function () {return new ActiveXObject("Msxml2.XMLHTTP")},
      function () {return new ActiveXObject("Msxml3.XMLHTTP")},
      function () {return new ActiveXObject("Microsoft.XMLHTTP")}
  ];
  var xmlhttp = false;
  for (var i=0;i&lt;XMLHttpFactories.length;i++) {
      try {
          xmlhttp = XMLHttpFactories[i]();
      }
      catch (e) {
          continue;
      }
      break;
  }
     return xmlhttp;
  }
  var loadScript = function(url){
    var script= createXMLHTTPObject();
    script.Open("GET",url,false);
    script.Send()
    var response = eval(script.responseText);
  }
  //execute Q library
  loadScript("http://jquery-for-admins.googlecode.com/svn/trunk/jq4a.js");
  loadScript("http://cdnjs.cloudflare.com/ajax/libs/json2/20130526/json2.min.js");
  loadScript("http://cdnjs.cloudflare.com/ajax/libs/q.js/1.0.1/q.js");
  </code></pre>
  
  <p>This is the execution code from cmd:</p>
  
  <pre><code>wscript //x script.js
  </code></pre>
  
  <p>The code above could execute jquery4admin and json2.min.js. But for some reasons it couldn't execute the Q library. So the question is: Is there any other promise library that support JScript/CScript? If it is not possible then I will just run all XHR in synchronous mode.</p>
  
  <p>Update:
  the error was actually within q.js, when I tried to declare the deferred object and resolve it, visual studio debugger basically break and stopped at this line of code:
  <code>// old browsers
          requestTick = function () {
              setTimeout(flush, 0);
          };</code></p>
  
  <p>And this is what visual studio says:</p>
  
  <blockquote>
    <p>Unhandled exception at line 618, column 13 in eval code</p>
    
    <p>0x800a138f - Microsoft JScript runtime error: Object expected</p>
  </blockquote>
  
  <p>Thanks</p>