Friday, May 15, 2009

mIRC Snippets : SendKeys as Keystrokes Simulator

IRC scripts are a way of shortening commands and responding automatically to certain events while connected to an IRC Network. Many scripts have realy good and intresting tools, popups and menus. I've seen some of them have "unusual" things in their features, provide to use some external files, code-keys of non-irc-based-program, programs from other protocols such FTP,MAIL,HTTP ect.

This simple snippet allows you to simulate keystrokes in mIRC, i.e makes mIRC execute whatever commands would be executed by pressing the specified key(s). It does that by using the SendKeys method of the WshShell object.


        //sendkeys (key combination)

For Example, to open the mIRC Option Dialog you just type:

        //sendkeys % $+ o

Note: % is ALT key. We can't use %o because mIRC would think it's a variable. Also note that I didn't use a capital O. In Alt/Ctrl+ combinations only the lowercase can be used

I know this is already possible with a dll (a lot of scripters know and use sendkeys.dll) but a few people may interest in using this, so here it is.

Copy and Paste the above code into your mIRC Remote Editor (Press "ALT+R" to open the dialog).

Still have no idea about how to use this snippet? here is once more full-blown example.

Say you want to add some items in your channel Popups menu to open some primary mIRC dialogs such Options dialog, Remote Editor, Address Book, Chat and Channels list dialog, then you should create its Popups code which looks something like:

menu channel {
  mIRC Options://sendkeys % $+ o
  Remote Editor://sendkeys % $+ r
  Address Book://sendkeys % $+ b
  DCC Chat://sendkeys % $+ c
  Channels list://sendkeys % $+ l

to see the result of this Popups code just copy and paste the code into your Remote Editor then try to right click in the main channel window you are in. is that easy? Yes!. Try it then you'll love it. Happy scripting!.


Post a Comment