Typing Numbers on the Number Pad

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.

Yes. See below Type a Keystroke:

But you can just press the keypad key when the keystroke box is selected:

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.

1 Like

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.

Here is how I am triggering the initial loop:

And here is the submarco performing all the switches (The maximum number would be 999 that is why I have it repeating 3 times. Each time being fed the next substring number):



When it works, it is working perfectly and I will definitely be able to use it in my desired application! Thanks for your help so far!

I'm also attached the macros for testing, if needed. Thanks so much!
Switch Marker Numbers for Keypad Numbers.kmmacros (10.3 KB)
Cycle Through Markers.kmmacros (6.0 KB)

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

There are other changes to cleanup/optimize the macros.

Here are my versions, which I hope will serve as a guide for you.
Please let us know if this works for you, and/or you have questions.


###MACRO:   Cycle Through Markers @JMichaelTX

~~~ VER: 1.0    2017-09-15 ~~~

####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/d/d86dac6805e07937348494231d392df4314be5db.kmmacros">Cycle Through Markers @JMichaelTX.kmmacros</a> (5.7 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---


<img src="/uploads/default/original/2X/a/a68eafe8f220e55acaa244826c92d746a2bcc5c0.png" width="612" height="1517">

##Macro Library   Type KeyPad Key [Sub-Macro]


####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/e/e77e9a607866081f2db30d098de283f72076690d.kmmacros">Type KeyPad Key [Sub-Macro].kmmacros</a> (8.4 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---


<img src="/uploads/default/original/2X/b/b3fb050b34579898d81fba0dce6e891db79092ba.png" width="612" height="1886">
1 Like

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

1 Like

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.

Hope this helps.

Okay thanks a lot. That can help me put that attempt to rest and follow onward using your example. Thanks again!

@Dan_Smith,

If one of the above posts solves your problem/question as originally stated, please check the “Solved” checkbox (click for details) at the bottom of that post.

Otherwise, please post your remaining questions/issues about this problem.
If you have other questions, please start a new topic.

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:

  1. Prompt for user input: “Edit No” (up to 3 digit number)
  2. Type: numpad .
  3. Type variable “Edit no” on the numpad
  4. Type: numpad .
  5. click at a point on the screen
  6. Type: numpad .
  7. Type numpad5 then edit number on the numeric keypad
    1. 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.

If you could help me do that I would be eternally grateful!
Thanks

1 Like

The macro that @JMichaelTX posted:

Will type a specified numeric digit character with the keypad.

You type a sequence, use something like this:

Keyboard Maestro Actions.kmactions (1.3 KB)

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