mIRC Home    About    Download    Register    News    Help

Print Thread
#260231 18/03/17 02:26 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
OP Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
I'm not sure how else to explain this than to show it as code:

Code:
alias -l addjs {
  bset -t &example $calc(1 + $bvar(&example,0)) $1-
}
alias example {
  addjs example=function(){
  addjs     var request = new ActiveXObject('MSXML2.SERVERXMLHTTP.6.0');
  addjs     request.open('GET', 'https://forums.mirc.com/ubbthreads.php/forum_summary', true);
  addjs     request.send();
  addjs     request.waitForResponse(60);
  addjs     if (request.readyState == 4) return "Done";
  addjs     request.abort();
  addjs     return "Timeout";
  addjs };

  var %js = example()

  comopen example MSScriptControl.ScriptControl
  echo -a Language: $com(example, language, 4, bstr, jscript)
  echo -a JS Load : $com(example, ExecuteStatement, 1, &bstr, &example)

  .timer -iom 1 0 echo -a Timer Triggered

  echo -a Calling function
  echo -a Called: $com(example, eval, 1, bstr, %js) $com(example).result

  comclose example
}


When the script is executed, the timer triggers while mIRC is waiting for the com to return:
Code:
* Opened Com 'example' (MSScriptControl.ScriptControl)
-
Language: 1
JS Load : 1
Calling function
Timer Triggered
Called: 1 Done
-
* Closed Com 'example'

Last edited by FroggieDaFrog; 18/03/17 02:26 AM.

I am SReject
My Stuff
Joined: Dec 2002
Posts: 5,412
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,412
I changed the URL to use a website with a large, slow loading page, added a long-running while loop (to freeze mIRC) after the final $com() call, and then ran the alias.

The first thing I noticed is that I can type into the status window editbox during the slow $com() call. The moment the $com() call returns, the while loop runs and freezes mIRC. This seems to indicate that the COM object itself is causing Windows messages to be dispatched to mIRC while the COM object is waiting for the website to reply. As the mIRC /timer uses Windows messages, it is being triggered.


Link Copied to Clipboard