Need help sending command to another program

Blake81

Well-known member
Joined
Feb 23, 2006
Messages
304
Location
Georgia, USA
Programming Experience
1-3
Hi, I need to know if this is possible before I start trying to make this application. I want to make an admin console to use in mIRC for my server. Is it possible to make a program in VB that will send a command to an open session of mIRC so that mIRC runs the command? Here's an example. (and I'll also need to talk to people who know mIRC to see how I can get it to do some things on that end). Back to my example. In mIRC, to make someone a channel operator, you type /mode #channelname +o Name. Is there any way to have my VB program tell mIRC to run that command when I select a name in my admin consol and hit the "op" button? Thanks.
 
Thanks. I looked at that and it was some help, but I found something else to help that's written for VB. I'm actually thinking about two projects, so I've started with writing an IRC bot in VB. I have one problem with what I have so far. In one of my button click events, it's saying that my socket name isn't declared. What should I do to fix that? I've declared it earlier. Here's the code.
VB.NET:
[SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE][SIZE=2] Form1
[/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form1_Load([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]MyBase[/COLOR][/SIZE][SIZE=2].Load
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Sock [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Net.Sockets.Socket
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Server [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Net.IPEndPoint(3232235873, 6667)
Sock.Connect(Server)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Sock_Connect()
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Sock [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Net.Sockets.Socket
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Server [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] System.Net.IPEndPoint(3232235873, 6667)
Sock.Connect(Server)
Sock.Send([/SIZE][SIZE=2][COLOR=#800000]"NICK "[/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#800000]"VB_Bot"[/COLOR][/SIZE][SIZE=2] & vbCrLf)
Sock.Send([/SIZE][SIZE=2][COLOR=#800000]"USER "[/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#800000]"VB_Bot"[/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#800000]" "[/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#800000]"Dorothy"[/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#800000]" "[/COLOR][/SIZE][SIZE=2] & _
UCase([/SIZE][SIZE=2][COLOR=#800000]"Dorothy"[/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#800000]":"[/COLOR][/SIZE][SIZE=2] & 1903 & [/SIZE][SIZE=2][COLOR=#800000]"/0"[/COLOR][/SIZE][SIZE=2]) & [/SIZE][SIZE=2][COLOR=#800000]" :"[/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#800000]"VB_Bot"[/COLOR][/SIZE][SIZE=2] & vbCrLf)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Public[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button2_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Button2.Click
Sock.send([/SIZE][SIZE=2][COLOR=#800000]"JOIN "[/COLOR][/SIZE][SIZE=2] & TextBox1.Text & vbCrLf)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Private[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Button1_Click([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] sender [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.Object, [/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] e [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] System.EventArgs) [/SIZE][SIZE=2][COLOR=#0000ff]Handles[/COLOR][/SIZE][SIZE=2] Button1.Click
Sock_Connect()
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub
End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Class[/COLOR][/SIZE]


On the Button2_Click, it says that the name Sock is not declared
 
I actually have just a few things I need help with. I just need to be able to use a socket to connect to the local network IP address on a certain port, and to be able to send and receive data. I need to be able to parse the incoming data so I can put it in the correct text/list boxes and respond to it.
Since I'm most familiar with mIRC scripting, and pretty new to VB programming, I only know what I was able to do in mIRC and I know that I'd like to be able to do some of those same things with the data in VB. However, I'm not sure how to do it. One thing that was handy in my mIRC scripting was the use of tokens. I know that not all of this post has to do with networking and sockets, but some of it does, and I didn't want to unnecessarily start a new thread.
As I mentioned, using tokens in mIRC was very useful. How would I do something like the following in VB? Say I had a line that looked like this:
word1 word2 word3.
In mIRC, I could tell it that the tokens were separated by spaces, and that I wanted the second token, and it would return "word2". How could I do that in VB? Thanks for being patient with me and helping.
 
Back
Top