Is there a way to specify that numbers being typed by a macro, are typed as if entered on the number pad?

Background:
I work in Pro Tools for editing audio. I can leave markers at certain locations. To recall a marker, and move to its location I can enter a key sequence. The key sequence is “Numpad Period, Numpad Number, Numpad Period” So if I want to go to marker 40 it would be “Numpad Period, Numpad 4, Numpad 0, Numpad Period”.

I have a lot of great little macros I’ve written for Pro Tools. I’m trying to work out a way to apply these macros multiple times rather that firing them individually. So I could setup markers and apply them to the audio at a set of markers.

I have everything working except for making it automatically locate to the markers. I can hard program a single one with no problem. But if I want it to loop through say the first ten markers, I need a loop with a calculation and a counter, incrementing my marker number. Easy enough to do if it were entering just regular numbers. But it must be numbers typed on the number pad for Pro Tools to recognize the key sequence and locate to the marker.

I hope that makes sense. If not currently implemented, I think it could be done with a preference or maybe setting for the “Enter Text by Typing” action that would make all numbers typed be sent as numpad numbers.

Let me know if there is currently a way to do this, otherwise it is a feature request. As always. I love Keyboard Maestro. Great Software. Amazing job.

Thanks for the reply. I have used the action you demonstrated. However I need to able to have the macro make calculations and then type out the numbers. So the numbers can’t be hard programmed. They need to be variables.

No, there is no way to specify which of the keys that makes the desired character is pressed. There isn’t even any real guarantee as to whether the main keyboard or the number pad will be pressed, it could be either. Keyboard Maestro doesn’t “know” anything about the keyboard, it just looks at the keyboard map and reverse maps it to figure out what keys to press to get the desired result. There aren’t any special casing as to which keys if two keys can both generate the desired result.

Instead, if you need this specifically, I suggest you make a sub-macro that takes a digit and uses a Switch statement to press the appropriate number pad key. So something like:

switch text %TriggerValue% of

case 0

Type Number Pad 0

case 1

Type Number Pad 1

case 2

Type Number Pad 2

…

case .

Type Number Pad .

…

Then you could use For Each substring in regex (.) and pass it to that sub-macro and type the appropriate key as required.

Peter thank you so much for your help! Your response has put me on what I believe to be the right track. I’m trying to debug my submacro right now, and I am stumped. Perhaps you’d be willing to help.

It seems to have issues with zeros and repeating numbers. It is working fine in Pro Tools. But to see the output I’m testing it in a text editor. So if I try to have it cycle through markers 9-15 it should send the following keypad commands:
.9…10…11…12…13…14…15.
Instead it outputs this:
.9…01…1…12…13…14…15.

Same thing for 19-25 and so on:
Should be: .19…20…21…22…23…24…25.
Outputs: .19…02…12…2…23…24…25.

For numbers 100-110 it should be:
.100…101…102…103…104…105…106…107…108…109…110.
but it outputs:
.01…01…012…013…014…015…016…017…018…019…01.

Swapping out my switches in the submacro for a simple insert text by typing action, it outputs the correct digits. So I feel it is being passed the correct numbers in order, but something about the switches or the order is messing things up.

It seems to have issues with zeros and repeating numbers. It is working fine in Pro Tools. But to see the output I’m testing it in a text editor. So if I try to have it cycle through markers 9-15 it should send the following keypad commands:
.9…10…11…12…13…14…15.

OK, I think I have a major revision to your macros that should do the job.
The key changes are:

Wow Thank you so much! I really appreciate your help. Your macros work perfectly. I’m learning a lot about optimization by looking through examples. I certainly can improve in the design and efficiency of my macros. I very much use one action per task and go step by step. So it is extremely helpful to see how someone with your skill would do it.

I still am not sure as to why my method wouldn’t work, but I can definitely see how it would be more prone to error with the way that it is setup. Just for my knowledge, is there anything that pops out to you as to what was causing the numbers to output incorrectly?

But the way you are doing it with the For each and while is much better. I think in my head I’m programming the math and action into the macro, whether than understanding all the actions available that can do that work for me.

Either way, thank you very much. This will certainly work for the tasks I have in mind for it.

Also the %ExecutingMacro% for the title of the prompt blew my mind. Didn’t know about that one! Thanks

Just for my knowledge, is there anything that pops out to you as to what was causing the numbers to output incorrectly?

I believe the main cause was that you were not calling the keypad macro for EACH character in the ConformMarker. Also, in the keypad sub-macro you were using “match” instead of “is” (which means equal to). “Match” invokes the RegEx engine to match the first character.

Hi. I’ve been trying to follow this thread as I also want to type numbers on the Numpad to use in a (much simpler) Pro Tools macro, but the discussion is going way over my head. I wonder if you could help me make a macro that does the following:

Prompt for user input: “Edit No” (up to 3 digit number)

Type: numpad .

Type variable “Edit no” on the numpad

Type: numpad .

click at a point on the screen

Type: numpad .

Type numpad5 then edit number on the numeric keypad

Type: numpad .

So the macro would first promt me to enter a number then do ". ### . click at location . 5### .
I know how to type the . and click at a location, it’s just the typing a variable number on the numpad that I’m stuck with.

OK, I think I have a major revision to your macros that should do the job. The key changes are: In the Cycle Macro: ADD a For Each action (KM Wiki) to type the keypad for each character in the ConformMarker Change the Repeat Action to a While action (KM Wiki) . In the “Switch Marker Numbers” (which I have renamed “Type KeyPad Key [Sub-Macro]”) Consolidate all of the Switch blocks into ONE Switch or Case action (KM Wiki) block Use the %TriggerValue%, which is passed as a Parameter in the…

That could similarly be made into a Sub-Macro like @JMichaelTX’s macro. And then called from a macro that performed the steps you outline (make sure you have a pause before/after the click if necessary).