|
|
Joined: Jun 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Jun 2004
Posts: 7 |
Is it possible to run a program from mIRC and start certain actions after that program is finished depending on the exit value?
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
alias exitcode { - var %a = wsh $+ $ticks
.comopen %a Wscript.Shell if !$comerr { if $com(%a,Run,1,bstr,$1,uint,5,bool,true) { var %code = $com(%a).result } .comclose %a return %code }
} Usage: $exitcode(<program file>)This is a modified version of /xrun. A couple of links: Introduction to COM, WshShell.Run() Method.
|
|
|
|
Joined: Apr 2003
Posts: 701
Hoopy frood
|
Hoopy frood
Joined: Apr 2003
Posts: 701 |
This will pause mIRC while the program is running if I understand correctly... Since I'm interested in this sort of thing: is there also a way to just let the script (and mIRC) continue and have the return code returned (erm, yeah) to mIRC when the program finishes? Or have mIRC request the return code, like have a timer that checks if the program is still running and have it request it when the program has ended?
|
|
|
|
Joined: Dec 2002
Posts: 1,922
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,922 |
$exitcode won't freeze your mIRC, but it's better to use $comcall here. alias part1 { - var %a = wsh $+ $ticks
.comopen %a Wscript.Shell !.echo -q $comcall(%a,part2,Run,1,bstr,ping.exe 127.0.0.1,uint,5,bool,true)
} alias part2 { - echo -a Exit code: $com($1).result
.comclose $1
}
|
|
|
|
Joined: Jun 2004
Posts: 7
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Jun 2004
Posts: 7 |
That helps, tyvm. Surely better than including sendmessage support in such a small helper program.
|
|
|
|
|
|