Stdout
/*
Usage: //echo -a $console(CMD) ; where CMD is valid input for a command console.
Example: //echo -a $console(ipconfig /all)
Notes:
1) Information returned is delimited by $crlf which allows for mIRC to return all of the information on one line as opposed to a consoles method of returning information on multiple lines.
*/
alias console {
if (!$com($flag(1))) && (!$com($flag(2))) && (!$com($flag(3))) {
.comopen $flag(1) wscript.shell
noop $com($flag(1),exec,1,string,cmd /c $1-,dispatch* $flag(2))
noop $com($flag(2),stdout,3,dispatch* $flag(3))
.timerstdout -m 0 100 stdout
pause 2
.timer 1 0 unset %consoleoutput
return %consoleoutput
}
else return * /console: COM connections already open.
}
alias -l flag return mirc $+ $gettok(console stream stdout,$1,32)
alias -l pause {
var %w = wsh $+ $ticks
.comopen %w wscript.shell
.comclose %w $com(%w,run,1,bstr*,$(%comspec%,) /c ping.exe -n $1 127.0.0.1 >nul,uint,0,bool,true)
}
alias -l stdout {
noop $com($flag(2),status,3)
if ($com($flag(2)).result) {
.timerstdout off
while (!$com($flag(3)).result) {
%consoleoutput = %consoleoutput $null($com($flag(3),readline,3)) $com($flag(3)).result $+ $crlf
noop $com($flag(3),atendofstream,3)
}
.comclose $flag(1)
.comclose $flag(2)
.comclose $flag(3)
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
/*
Usage: /console CMD ; where CMD is valid input for a command console.
Example: /console ipconfig /all
Notes:
1) Information echoed is delimited by $crlf which allows for mIRC to show all of the information on one line as opposed to a consoles method of returning information on multiple lines.
*/
alias console {
.comopen $flag(1) wscript.shell
noop $com($flag(1),exec,1,string,cmd /c $1-,dispatch* $flag(2))
noop $com($flag(2),stdout,3,dispatch* $flag(3))
noop $comcall($flag(2),stream,status,3)
}
alias stream {
var %stream
while (!$com($flag(3)).result) {
%stream = %stream $null($com($flag(3),readline,3)) $com($flag(3)).result $+ $crlf
noop $com($flag(3),atendofstream,3)
}
echo -a %stream
tokenize 32 $flag(1) $flag(2) $flag(3)
.comclose $*
}
alias -l flag return mirc $+ $gettok(console stream stdout,$1,32)