Jump to content
Macro Express Forums

Assistance with Keystroke - Keyboard macro


Recommended Posts

Good Afternoon everyone,

 

I'm new to the macro creation process, and I'm hoping to get some assistance with a macro i'm trying to build. I need to find a way that the macro can be built with keystrokes, and part of the macro needs to push CONTROL and the key S at the same time (ie to save the event). If at all possible, I want the entire macro to be keystrokes, and I am struggling to find any info on how to do this. I hope someone can point me in the right direction here. 

 

Thanks,

Nate

Link to comment
Share on other sites

You're on the right track. Many people start with recording mouse movements and such, but it's better to write it from scratch and use as many keyboard shortcuts as possible. 

Text Type command under Keyboard is what to use. Most keystrokes are simply a matter of entering them in the script, but some are "chords" where multiple are done at once. Having said that, the alternate mode keys actually modify what is sent to the PC. For ones like Ctrl+S it is as simple as putting those in there. MEP is smart enough to know to essentially hold the ctrl key <CONTROL> down for yoru next keystroke. But if you ever need to do multiple keystroked modified, you need to use the <CTRLD><CTRLU> around those keys. 

Link to comment
Share on other sites

If you hang around this forum long enough, you will start to notice two factions: those who insist that this is the best way:

 

Text Type (Simulate Keystrokes): <CTRLD>s<CTRLU>

 

And those who say this approach is fine:


Text Type (Simulate Keystrokes): <CONTROL>s

 

The truth (as I see it, anyways!) is that both approaches have a place. The former is probably more reliable than the latter. However, when the latter works, it seems to be equally reliable.

 

Personally, I favour the second technique because I find the code a little easier to read. But if the macro fails with that line of code, I switch to the first technique.

 

For the kinds of macros that I build, the second approach works for me 95% of the time. But people who use Macro Express for different purposes than I do might be right that the first approach is superior.

Link to comment
Share on other sites

Thank you @acantor

I definitely expect to hang around the forum a lot. In this particular instance typing <CONTROL>s actually resulted in the script hitting control and then typing the letter s.

 

For this particular project, it’s going to work best if I allow a delay because it’s data lines going into a system. The CTRLD CTRLU absolutely worked perfectly but I will keep exploring the capabilities of the software.

Link to comment
Share on other sites

On 8/18/2022 at 1:33 AM, acantor said:

The truth (as I see it, anyways!) is that both approaches have a place. The former is probably more reliable than the latter. However, when the latter works, it seems to be equally reliable.

 

 

Excellent advice.

The right one for you might depend on where you want to deploy keystrokes (target software), and the exact combination of control keys.

The target software may have a mind of its own.

 

Software writers also have a habit of changing how they go about things. There may also be several different keyboard strokes of achieving the same result. With or without using menus for example.

The important thing is to remember that both options exist. If one approach doesn't work, try the other one.

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...