P.I. Engineering User Forum

Product Support, Technical Questions and Answers, and Examples for P.I. Engineering Products

You are not logged in.

#1 2016-10-05 07:23:27

programmablekeyboards.eu
Member
Registered: 2016-10-05
Posts: 4
Website

Repeat key press or mouse click while key down

Hi

Is there a reliable way to repeatedly click with the mouse while pressing a key down?

I have tried this sequence:

Key pressed:
Mouse Left Down-Up
Delay 100
Auto Repeat -1, -1

If I leave out the delay time, it does not work either.

FWIW, here is the code:

If State 'Pressed          [MWTAG10]
				'<Mouse Left Down-Up>
				MW3.sendMouseClick("Left",true)
				'</Mouse Left Down-Up>
				'<Delay[100]>
				MW3.insertDelay(100)
				'</Delay[100]>
				'<Auto Repeat[-1,-1]>
				MW3.RepeatCID(MyDevice,CID,-1,-1)
				'</Auto Repeat[-1,-1]>
			Else 'Released             [MWTAG11]
			End If 'Press-Release      [/MWTAG10/MWTAG11]

Last edited by programmablekeyboards.eu (2016-10-05 07:26:22)


X-keys vendor in Europe: www.programmablekeyboards.eu

Offline

#2 2016-10-05 08:00:49

PIE Amber
Technical Software Developer
From: Williamston, MI
Registered: 2016-01-21
Posts: 196
Website

Re: Repeat key press or mouse click while key down

The problem with your macro is which mouse function you selected. Mouse Left Down-Up is intended to "hold down" the mouse button. To get it to click repeatedly, you need the instant action of Mouse Left Click. Just swap that out and I think you'll be good.

Key pressed:
Mouse Left Click
Delay 100
Auto Repeat -1, -1


Amber from P.I. Engineering

Offline

#3 2016-10-05 09:00:00

programmablekeyboards.eu
Member
Registered: 2016-10-05
Posts: 4
Website

Re: Repeat key press or mouse click while key down

OK, got it. You were right, it works on most Windows apps.
On one flash based program it does not.

Is there a way to recreate this in Hardware Mode?
Mouse Click is disabled and down-up does not work again.


X-keys vendor in Europe: www.programmablekeyboards.eu

Offline

#4 2016-10-05 10:03:14

PIE Amber
Technical Software Developer
From: Williamston, MI
Registered: 2016-01-21
Posts: 196
Website

Re: Repeat key press or mouse click while key down

Yes, you just need to use two different functions:

Mouse Left Down
Mouse Left Up
Delay
Auto Repeat

The problem with "Mouse Left Down-Up" is that it splits the up and down to press and release (causes the "hold down" behavior like with keystrokes), which is what you don't want. You just need the "down" and "up" one after another -- the same thing that "Mouse Left Click" in software mode accomplishes.


Amber from P.I. Engineering

Offline

#5 2016-10-05 10:15:36

programmablekeyboards.eu
Member
Registered: 2016-10-05
Posts: 4
Website

Re: Repeat key press or mouse click while key down

Thanks, it worked like the software macro, just not for the app. Really strange.


X-keys vendor in Europe: www.programmablekeyboards.eu

Offline

#6 2016-10-05 11:07:50

PIE Amber
Technical Software Developer
From: Williamston, MI
Registered: 2016-01-21
Posts: 196
Website

Re: Repeat key press or mouse click while key down

Does it not work at all in the app or does it only click once, or something like that? The app could be shutting down too-rapid mouse input; it's entirely possible. A lot of games shut down that kind of thing to prevent cheating, for example.


Amber from P.I. Engineering

Offline

#7 2016-10-05 12:08:30

programmablekeyboards.eu
Member
Registered: 2016-10-05
Posts: 4
Website

Re: Repeat key press or mouse click while key down

I just figured out that I had to insert a delay between the mouse down and up.

In Hardware Mode it looks like this now, and it works.
Mouse Left Down
Delay[100]
Mouse Left Up
Auto Repeat


X-keys vendor in Europe: www.programmablekeyboards.eu

Offline

#8 2016-10-05 13:35:13

PIE Amber
Technical Software Developer
From: Williamston, MI
Registered: 2016-01-21
Posts: 196
Website

Re: Repeat key press or mouse click while key down

Ah, good to know. I'd not seen that be necessary before with mouse commands, but I have with keystrokes.


Amber from P.I. Engineering

Offline

Board footer

Powered by FluxBB