Reference Pause

Is there a way to refrence a pause within the macro itself? I often reference to other macros so I only have to update it once however I frequently find myself needing to referene "Pause for X Seconds" action and would like to update that within the macro itself for when I get to a different computer or things are running faster. Is there a way to do this so the multiple pauses in the macro can all reference the same delay at the top of the macro and so I can experiment with changing that delay in one location?

Hopefully I don't have to create another macro that links to these references. I am trying to keep the macro library a bit more clean since I already have nearly 5,000 macros.

I'm not sure I understand the question fully, but I think you're asking if there's a way for every Pause action to refer to the same value. If that's the question, then yes, you can do it with a global variable:

Set thePause (or whatever you name it) to the time interval in seconds, and it will apply to every action that uses the variable.


The field in the "Pause" action is a "Number" field and so can take variables and even do calculations. So if you want all the pauses except one in a macro to be n seconds but the exception to be 2n, and decide to try n as 2 seconds:

But have a good look at those pauses and see if you change them to "Pause Until..." some condition changes -- then your macros will run as best they can, without constant tweaking from you.

1 Like

Thank you you are very fast! I was just getting back on to say I think I figured it out after messing with it. I have to run the variable to update it. Great to know this can be done there are so many places I would have used this in the past and will reference this in the future.

Because it's a global variable, you really don't need to set it in a macro, unless you want/need to change it often. You can just set it directly in the Variables panel of Keyboard Maestro's preferences, and it will stay there until you delete it.

If you need to change it, you can edit it there, too. (You could also write a super simple "Change the pause" macro that just sets the value.)


1 Like

Thank you very helpful @Nige_S I am trying to have text typed into OmniFocus and for some reason a lot of the text is getting missed. There are so many times I want to use Pause Until but not sure what to even look for in these cases.

I appreceate the visuals that was very helpfu and cool you can put it all in one pause (Local_pauseTime * 2).

Good point thank you.

You need to work out why text is getting missed.

Is OmniFocus activating too slowly (missing the first few characters)? Try a "Pause Until..." the correct window is active.
Is the macro "moving on" too quickly (missing the last few characters)? Try a small "Pause" after the action.
Is the typing too fast for OmniFocus (missing characters throughout the string)? Precede the action with a "Set Action Delay" set to slow down the typing speed.

And you could always try "Insert by pasting..." instead!

If your typed text is getting messed up you should look at this Set Action Delay - wiki page here action:Set Action Delay [Keyboard Maestro Wiki]

1 Like

Thanks you @Nige_S and @tiffle that set action delay is awesome and exactly what I was looking for. I will use that instead. I completely missed that as an action. Much slicker than having to stick pauses inbetween everything.

I did try to paste everything and it was messing up consistently in the same places. I restarted OmniFocus a couple times and the second time it seemed to fix things. Not sure what exactly happened but glad it is working now.

Everytime I learn new actions like that I feel like I am adding to my wizard bag of tricks. Thanks for sharing that.


One nice thing about using a variable to store all your macros' Pause durations is that you can change its value. In fact, you can even give the user a method to change the value. For example, this single action could increase the value of thePause by 20%, which would result in all Pause actions to wait a little longer:


As for me, when I create global variables, I always think about a way to let the user change their value. So for example, I would like the user to be able to increase thePause by 20% when one button is pressed, and reduce the value by 20% when a different button is pressed. I would also show the user the new value. And I would insert some code to handle the case where thePause is not set, and for the case when the user tries to change the value twice in a row before the first change is completed.

thePause Handler Macro (v11.0.2)

thePause Handler.kmmacros (6.8 KB)

In the above case, I use a mouse button to increase the Pause value, and a control mouse button to decrease the Pause value. Also, it's worth noting that the symbol used for "control" is not the keyboard symbol (^), it's a different symbol (⌃).

This is fantastic, thank you for chiming in and for the macro, that is very apprecated and helpful.

Thanks! I always try to make my code flexible like this. For many people, this is overkill. But I sure like writing code like this.