Jump to content
Macro Express Forums

Holding Keys Down


hosho

Recommended Posts

Okay, here's what's happening. The program I have the macro running in isn't registering some of my keystrokes, because they don't last long enough. I need to be able to tell macex to put a key down, hold it for 100ms or so and then lift it up again.

 

Now I know how to do that with alt/ctrl/shift/win keys and stuff like that, but is there any way to do it with other keys?

 

The key i need held down is "d". My current answer is just to "Text Type: ddddddd" and prey it registers, but that's not the most reliable solution. Anyone help me out?

 

Thanks.

 

.:Hosho :blink:

Link to comment
Share on other sites

Welcome to the forum!

 

This sounds very odd. Never heard of it happening. Do you have to hold the d down when you are running the software yourself (i.e. without using a macro)?

 

Maybe the application would prefer that the macro pause for a few milliseconds between keystrokes. If so, then use the Set Keystroke Speed command, which sets a delay between each key sent to the keyboard buffer. Drawing on your example:

Keystroke Speed: 100 Milliseconds
Text Type: ddddddd

The above would take 700ms to type out. However, since we are talking about a single d and not a string of them, have you tried the Wait Text Playback command? From the Macro Express help system:

Wait for Text to Play Back:

This option would only be used immediately after a Text command. You don't want the macro to continue on before the text from your text command has finished playing back. Selecting this option will stop the macro from continuing until the text has finished playback.

Text Type: d
Wait Text Playback

Link to comment
Share on other sites

I already encountered such a problem on a Flash program : it seems that simply pressing a key was not "long" enough, whatever keystroke speed I chose ... I did not find any answer but a "push key" / "release key" function would have been appreciated (it is already available for Ctrl/Shift/Alt keys)

Link to comment
Share on other sites

Thanks for the input you two. :D

 

I tried changing the speed, it didn't work. I'd had the idea before, but I didn't code it "properly". (i did text type: d, delay: 100ms, over and over..)

 

I had no idea there was a wait text playback function, that'll come in useful later on i'm sure.. but sadly, not this time.

 

The strangest thing is happening. Even when i capture the macro from my own keystrokes, my keystrokes work, the macro only half works, even at the same speed.

 

Is a Key up/Key down function even possible under a windows environment? I'm no expert but it wouldn't suprise me if windows itself stopped such a function from being implemented..

 

In the meantime i'll learn to make-do with my "ddddd" option. Thanks again guys, didn't fix the problem but huge help nevertheless. :)

 

.:Hosho :blink:

Link to comment
Share on other sites

Yes, whenever you press a key, at least 2 events are generated - a keydown event and a corresponding keyup event. And when you introduce enhanced keys (e.g. Alt, Ctrl), then you get additional keystrokes for the enhanced keys.

 

I'm currently trying to add a new feature to our Pgm Library where I can trap and control almost any key stroke (excluding Ctrl-Alt-Del and Pause/Break). It's remarkably difficult to do even with a global hook. It may also be more complex because of course macro Express also hooks into the keyboard - I'm not yet certain about this.

 

An additional consideration is whether a keystroke is repeated, as in your dddddddd. here timing plays a part, so it becomes even more difficult!

Link to comment
Share on other sites

  • 3 months later...

I've also asked for such a feature back when this forum was on a newsgroup ;) (global key down/key up events instead of just tied to win/alt/ctrl/shift) as i have a program or two that utilizies multiple key combinations and just typing the keys is not sufficient.

 

I still would love this feature.

Link to comment
Share on other sites

I've also asked for such a feature back when this forum was on a newsgroup ;) (global key down/key up events instead of just tied to win/alt/ctrl/shift) as i have a program or two that utilizies multiple key combinations and just typing the keys is not sufficient.

 

I was referring only to those keys Windows itself recognizes as "special" keys, i.e. Win, Alt, Ctr and Shift.

 

If you want to treat other keys as modal (in the sense that they change the meaning of whatever other key is pressed at the same time), you'll have to provide a really low-level keyboard handler (in other words it will become THE keyboard handler for the whole of Windows) - which I imagine is probably impossible to achieve.

 

A high-level keyboard handler has to abide by the rules imposed from below; some keys are not even passed on by Windows (e.g. most Alt combinations).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...