mIRC Home    About    Download    Register    News    Help

Print Thread
#250650 25/01/15 05:25 AM
Joined: Oct 2014
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2014
Posts: 7
Code:
sleep {
  var %a $+(sleep.,$ticks,.wsf)
  write %a <job id="js"><script language="jscript">WScript.Sleep( $+ $$1 $+ );</script></job>
  .comopen %a WScript.Shell
  if !$comerr { .comclose %a $com(%a,Run,3,bstr,%a,uint,0,bool,true) }
  .remove %a
}

alias t1 sleep 1000 | echo -s one
alias t2 sleep 5000 | echo -s two

alias .t3 .timer -m 1 1 t2 | .timer -m 1 1 t1



According to my logic, the code above would echo "one" and will be followed by "two".
After trying several times even with /signal it's still echoed "two" and then followed by "one".

If there is another to do this please let me know. Thank you

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
this is b/c mIRC waits for a reply from the COM instance before continuing the process, so what happens is:


t2 com open
t2 com sleeps for 5s
mIRC waits for com reply
t2 echos
t1 com open
...


What adds to the strangeness though, is the fact is other scripts, or even other parts of the same script will still process events and such even as mIRC waits for the specific process to end.

I'm not sure if this behavior is intended but its quite useful.

---

Now, why do you need sleep? MANY people have asked for it, and in all cases /timer, though a bit more cumbersome, can be used in its place


I am SReject
My Stuff
Joined: Oct 2014
Posts: 7
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Oct 2014
Posts: 7
thank you for reply, i 100% understand how mirc process codes after read your comment.

and that means i need to find other way to make it happan and get similar result


Link Copied to Clipboard