I tried to use this function, but it doesn't seem to return after I call it.
-
EXAMPLE-
echo going | $wait 3000 | echo back
-
OUTPUT-:
*EDIT* *UPDATE*After some fiddling, I was able to get it to work. I must credit whoever came up with this method of causing mirc to sleep, it really is quite clever!
Here is my slightly modified (hopefully you will see the changes as an improvement!) wait alias code:
-
CODE-
alias wait {
; defaults to 1000ms
if ($1) { var %duration = $1 }
else { var %duration = 1000 }
var %tmp = $+($ticks,.wsf)
var %cmd = <job id="js"><script language="jscript">WScript.Sleep( $+ %duration $+ );</script></job>
write %tmp %cmd
.comopen %tmp WScript.Shell | if !$comerr { .comclose %tmp $com(%tmp,Run,3,bstr,%tmp,uint,0,bool,true) }
.remove %tmp
}
-
USAGE-
As far as I know, it can be used three ways from within a script:
;1st
$wait
; -or-
;2nd
$wait()
; both of these will default to 1000ms since no $1 arg is passed
;-or
;3rd
$wait(5000)
; will sleep for 5 seconds before deleting the tmp file and returning control to the caller.
Hopefully this will be helpful for someone at a future point in time. I would also like to give a BIG THANKS to
hmtX for posting this code to begin with!