mIRC Script is surely capable of doing whatever it is you're trying to do. Perhaps if you told us what that was, we could assist you better.
Eg: If you are auto-responding with various messages to various questions or commands, it is esceedingly easy to store these responses in a file and have mIRC reply with them. mIRC is capable of Regular Expression pattern matches which allows for sophisticated grammar interpretation that can borderline artificial intelligence.
Whatever the situation, I'm sure mIRC can accomodate it. Of course, you're more familiar with whichever language you currently use, but we're a fairly helpful bunch.
As far as your SendMessage issue, you should again research what mIRC's /help file has to say about it (/help SendMessage). If you create a mapped file
named mIRC using CreateFileMapping(), you would store your /msg in that mapped file instead of sending it directly to the query's editbox.