irc

How to write and send text to mIRC in C#/Win32?

穿精又带淫゛_ 提交于 2019-11-28 11:26:08
In a previous question, I asked how to send text to Notepad . It helped me immensely. For part 2, here's a simplified version of the same applied mIRC: [DllImport("User32.dll", EntryPoint = "FindWindow")] public static extern IntPtr FindWindow(String lpClassName, String lpWindowName); [DllImport("user32.dll", EntryPoint = "FindWindowEx")] public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("User32.dll")] public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam); IntPtr mainHandle =

How to strip color codes used by mIRC users?

半城伤御伤魂 提交于 2019-11-27 16:43:29
问题 I'm writing a IRC bot in Python using irclib and I'm trying to log the messages on certain channels. The issue is that some mIRC users and some Bots write using color codes. Any idea on how i could strip those parts and leave only the clear ascii text message? 回答1: Regular expressions are your cleanest bet in my opinion. If you haven't used them before, this is a good resource. For the full details on Python's regex library, go here. import re regex = re.compile("\x03(?:\d{1,2}(?:,\d{1,2})?)?