Simplistic Countdown Timer

Simplistic Countdown Timer (8.1 KB)

I pained over whether to post this because it's probably very basic to most folks.

I took the timer that Peter had posted and trimmed it down smaller, no scroll bars, soft color, off to the upper left of screen and had it call a large display text window when done (so that I have to address it!).
It also captures the current system volume setting, turns it up to xx, then restores the volume when done.

I've been getting a lot of use out of it, thought maybe someone else could use it.


Hey Troy,

Not bad at’all!

I do recommend you include an attribution comment in macros you upload though.


1 Like

Hi Chris, sorry, of course you are correct.
I may not post this correctly even now, but
peternlewis posted the following "Mac Menu countdown timer":

and I made 1 small change.

Thank you Peter and Chris.

1 Like

That's just what I needed. Just a couple tweaks for my use and it's doing the trick. Thank you for sharing!

1 Like

Great one! Thank u very much for sharing! I use it for a while now and it saves my day!

How do you enable the text window? it isn't triggered for me right now.

The text window at the end?
It is a separate macro that gets called from within the first macro's HTML....

Oh, sorry it was disabled, i had to check "trigger by any of the following..."

Btw - how can i get another field text to the html?

I wanted to add a "What" input field in to the users input and set it as variable,
then add it to the html window so i will see the task i'm working on now above the
counter. i tried using %What% (What is my variable) but it didn't work. also tried and didn't.

Also - if you have a minute to explain how (and where in the macro) exactly the other macro is called. i thought of maybe tweaking it to prompt the user input again (cause i'm mostly cycling through tasks one after the other) and also would like to learn how to this generally.

Thank you very very much!!!

Hi @troy,

Thanks for sharing it. I like it very much!
I have a question. What is "Manipulate a Display Text Window" doing?

Looks like it is a plugin that I don't have? I have disabled this action and do not have any noticeable issue.

1 Like

Are you looking for this in the HTML code?

window.KeyboardMaestro.Trigger( "Countdown Timer Display", "Trigger Value" );
1 Like

This gets the KM variable %Minutes% into the javascript.

window.KeyboardMaestro.GetVariable( "Minutes" )

You can add another variable to the Prompt for User Input action:

Add a line to get the variable value from KM. In this example case: "Var".

function SetClock() {
	var job = window.KeyboardMaestro.GetVariable( "Var" );

Change the following line in the same function to:

	clock.innerHTML = job + ' ' + minutes + ':' + ("0" + seconds).slice(-2);

You need to adjust the HTML window size. In this case, I changed the width to "220".

<body style="background: #d4cbff" data-kmwindowid="Archive MD5 Tamper" data-kmwindow="SCREEN(Main,MidX) -940,SCREEN(Main,MidY)-800,220,55">

I set the "Var" value to "HELLO". So, it will look like this:

1 Like

Thank @martin!

isn't there a way to insert variables to html without javascript?

1 Like

I think we have to use javascript to get KM variables if we use "Custom prompt with HTML text".

If we use "Custom prompt with HTML file", we can first use KM to change the content of the HTML file, then use the "Custom prompt with HTML file" action to execute it.

1 Like


I've made some modifications to @troy's macro.
I've made two macros, one stands alone, the other works with Alfred. Both can take timer duration arguments such as:

  • "5" means a 5 min timer.
  • "5s" means a 5 sec timer.
  • "1.5m" means a 1.5 min timer.
  • "0.5h" means a 0.5 hr timer.

The standalone macro can take an extra argument -- the task name. If no name needed, just leave it blank. If a task name is provided, the timer window is a little bit larger. If can show up to 7 letters long. If the task name is more than 7 letters, we can resize the timer window.


Standalone Timer with Task Name

Countdown Timer with Task.kmmacros (17.2 KB)


Timer with Alfred

The Alfred workflow takes only one argument, i.e., the timer duration. It will not take a task name.
This forum does not accept .alfredworkflow extension file. I need to zip the workflow file and KM macro.

Timer with (83.3 KB)


The KM macro is as below (the KM macro that goes with Alfred is similar):


Thanks for sharing! Was looking to incorporate Alfred with KM maestro and this example gave a lot of insight.

1 Like

You're very welcome!
I'm glad it's helpful to you!

Thx so much this is exactly what I was looking for. What do I alter to get the timer to display in a different screen location? currently it appears in the center. also anyway to make it more transparent?

I think what you need to do is insert this at the top of your Custom Prompt action:

<body data-kmwindow="

The numbers that I used above were percentages, which basically tell you the position (and size) of the screen in percentages that you want the window to be located at. In my case I said 0% for the first two lines, which means top left, and the second two numbers contain a minus sign which means the width and height are nearly full screen. Perhaps you just want to replace those last two numbers with something like 25%. You'll have to decide what you want.

Thx. This is the top:


body {
h1 {
font-family: Monaco;
font-size: 24px;

should I put above !DOCTYPE html or after style type="text/css"?

At the very top. Above DOCTYPE. Bear in mind I'm about at your level with this action. I barely know how to use it myself.