mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2014
Posts: 1
P
Mostly harmless
OP Offline
Mostly harmless
P
Joined: Feb 2014
Posts: 1
I want to program my mIRC bot like everytime someone
writes "F1" in the chat, the bot simulates F1 pressed on the keyboard.

So a bit like this:

Code:
on *:text:f1:#: {
  Button F1 gets pressed
}

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
This sounds like a terrible idea, but here you go:

Code:
on *:text:f1:#:sendkeys {F1}

alias sendkeys var %a = $ticks | .comopen %a WScript.Shell | if !$comerr { .comclose %a $com(%a,SendKeys,3,bstr,$1-) }


Reference: http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys(v=vs.110).aspx

Joined: Jun 2008
Posts: 12
S
Pikka bird
Offline
Pikka bird
S
Joined: Jun 2008
Posts: 12
Would it be possible to have it hold down the key for about 50ms?

Like the AutoHotkey function SendInput:

SendInput {Up down}
Sleep, 50
SendInput {Up up}

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Not with this method.

Joined: Jun 2008
Posts: 12
S
Pikka bird
Offline
Pikka bird
S
Joined: Jun 2008
Posts: 12
And with a different method?

Joined: May 2012
Posts: 12
T
Pikka bird
Offline
Pikka bird
T
Joined: May 2012
Posts: 12
Originally Posted By: Shanatan
And with a different method?


I know this is a ridiculously old thread, but I was curious myself as if there was any way to make it hold down a key, maybe with a different COM method?

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You can make it press a key x number of times but not hold it down for x seconds.

Change {F1} to {F1 50} to hit F1 50 times for example.


Link Copied to Clipboard