How Do I use a Variable for Pauses to Make Them Easy to Change?

I need help refining my KM macro - I use it daily and it consists of sequcnes going from 3 to 30 macros. I need help in:

  1. making one of the variable changeable from one place (it is a 'pause' that I would like ot change, sometimes it meeds 40 secs sometimes 50, etc etc). Right now I would have to go in the editor and tab trhu the macro and change that every time it shows up.

  2. making the actual script limited - it works and assigns letters (a-z); I would like an external change or switch so I can choose (for ex a-f or a-l).

I am pretty challenged so I am open to hiring someone to do this if it is more than a simple thing (disclaimer - i did not create the original macro)

Help!

Bob

For 1.
-You can create a macro called * Pause, which only contains the Pause until N seconds

  • then you insert it in the other macro(s) as Execute Macro where you need to change it.
    image

or you can ask it at the beginning:
image
and then use a Switch command to select how long to pause:
image

this is awesome, but I have NO clue how to do this. In a perfect world, I would click on KM, a box would pop up saying "enter x" (the letters to be inserted when the routine runs, for example entering M means that the routine will cycle thru until M and then stop), then "choose length" from a list; then 'run'. But I do not have the knowledge to do that. I would love to hire... if poss.

Hi There,
I would like to help you here. But I'm not clear of what you want.
Could you upload the current macro you have? So We/I can get a
better understanding what you are doing right now. And then propose a beter KM solution for that.

Thanks
Alphons

Keyboard Maestro 9.0.5 “X” Macro

X.kmmacros (92.2 KB)

the 'pause for 55 secs" could be a pulldown of options, and the 'type in the keystroke' currently goes a-w but I would prefer to choose for example a-f or a-M. But it is the 'pause' that needs the pulldown or at least a 'master' that I coukld thype in, to change it thru the list all at once.

It looks you have the need for a predetermined sequence of keystrokes.
If you want to change the waiting time, between the keystokes. (which can be done)
What makes the time different each time, where you have to wait for?
There is a function: Wait until....

wait until might work but it would have to respond to an action in my program?

right now I set it for a specific time (it is based on how long the program needs to executer before the next step.)

Oke, if the specific times are. correct. Which timings do you want to change?
(I 'll make a shorter version of you macro)

In this macro they say 55 seconds. For example many times I would want it to be 40 seconds, or 60

The KM Pause action can accept a KM Variable.

So at the top of your Macro, or in the KM Variables Panel, define a KM Variable for each Pause type you will need. For example:

Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.

Please let us know if it meets your needs.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MACRO:   Using Pre-Defined Pauses [Example]

-~~~ VER: 1.0    2020-03-05 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Using Pre-Defined Pauses [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can define your Pause types in several different places:

  1. At the top of the macro where they are used
  2. In another macro
  3. In the KM Editor Preferences > Variables
1 Like

S.kmmacros (94.3 KB)
You get the picture, of the improvement, I hope

I hope you don't mind that I have revised your topic title to better reflect the question you have asked.

FROM:
Help wanted to refine a macro

TO:
How Do I use a Variable for Pauses to Make Them Easy to Change?

This will greatly help you attract more experienced users to help solve your problem, and will help future readers find your question, and the solution.

Also, please submit each problem/question as a separate Topic in the future.

This is very different from your first question. Please submit a new topic with this question.

1 Like

Nope, I don't. You did NOT upload an image of your Macro. Please do so.

Yes, sure!!

thank you for your help - realize tho, i did not create my script (s) and have no idea how to implement what is being said. Is it possible to take my macro, and modify it, so that (as you so correctly said), when it starts it asks me 'how long' for that pause? I am clueless! I can also happily compensate for the work done....

Like So?

S.kmmacros (7.5 KB) !
Added at almost the top of the macro:

You could drag it just before the main pause. Than it will ask it each time
cheers

seems to be solve by the S.macro from above as well. Just change the lines to A-F or A-L

Even enhanced the macro for you in such a way you can play around with it in demo mode (so you don't have to wait that long each time) AND you can play around with the interface.

To play around: unselect the 'forReal' checkbox

PS For my convenience I changed the hot-key-trigger (change it to what ever you like of course)

S.v102.kmmacros (23.1 KB) !

2 Likes