/*
What does /exec do?
/exec will let you execute code in one of two languages: VBScript or mIRC.
How do I use /exec?
The syntax is: /exec <language name> <code> -or- $exec(<language name>, <code>)
You can use $exec(<language name>, <code>) to get the return value from the script executed if there is one.
How does /exec work? (For scripters)
/exec uses a COM object (MSScriptControl.ScriptControl) to execute code in (J/VB)Script.
Can you show me an example?
I'll show you two examples for each supported language, the examples use $& for readability.
VBScript:
1)
exec VBScript $&
While MsgBox("Do you like my snippet?", vbYesNo) <> vbYes $crlf $&
Wend
2) echo -a $exec(VBScript, Now)
mIRC:
1)
exec mIRC $&
var $+(%, x) = that $(|,) echo -a $+(%, x)
2) echo -a $exec(mIRC, return $time)
Is there anything else I should know about /exec?
Yes, when using the mIRC code executor everything is evaluated an extra time, so $exec(mIRC, return $!time) would still return the time.
*/
alias exec {
if ($1 == VBScript) {
var %exec = $+(exec, $ticks)
.comopen %exec MSScriptControl.ScriptControl
if ($com(%exec)) {
.echo -q $com(%exec, Language, 4, bstr, $1)
if (!$isid) { .comclose %exec $com(%exec, ExecuteStatement, 3, bstr, $2-) }
else {
.echo -q $com(%exec, Eval, 3, bstr, $2)
var %result = $com(%exec).result
.comclose %exec
return %result
}
}
}
elseif ($1 == mIRC) {
tokenize 124 $2-
scon -r $( $* , 2)
}
}