Send messages to your favorite IRC channel through mIRC via DDE. (Error messages via popup :)
Updated for mIRC 6.03: Now supports multi-server.
#!/usr/bin/perl use strict; use warnings; use Win32; use Win32::DDE::Client; my $favorite = qr/^Slashnet$/o; # favorite network MsgChan("Hello from Perl!", "#perlmonks"); sub GetConn { my $req = new Win32::DDE::Client('mIRC', 'EVALUATE') || Popup("Unable to initiate conversation with mIRC", 16, "DDE Err +or"); my $conns = $req->Request('$scon(0)'); # how many connections? my $scon; for my $conn (1 .. $conns) { my $network = $req->Request("\$scon($conn).network"); # what netwo +rk is connection on? if ($network =~ $favorite) { $scon = $conn; last; } } $req->Disconnect; return $scon; } sub MsgChan { my $conn = GetConn(); my $message = shift; my $chan = shift || "#muskrats"; my $mirc = new Win32::DDE::Client('mIRC', 'COMMAND') || Popup("Unable to initiate conversation with mIRC", 16, "DDE Err +or"); $mirc->Execute ("/scon $conn /msg $chan $message") || Popup("/msg failed", 16, "DDE Execute Error"); $mirc->Disconnect; } sub Popup { my ($msg, $flags, $title) = @_; return Win32::MsgBox($msg, $flags, $title); die $msg; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Quick and Dirty mIRC Interface
by Xanthic (Initiate) on Apr 20, 2003 at 07:34 UTC | |
|
Re: Quick and Dirty mIRC Interface
by Mr. Muskrat (Canon) on Jul 22, 2003 at 21:57 UTC |