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.
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.
Are you looking for this in the HTML code?
window.KeyboardMaestro.Trigger( "Countdown Timer Display", "Trigger Value" );
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:
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.
Hi,
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:
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.
Countdown Timer with Task.kmmacros (17.2 KB)
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 Alfred.zip (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.
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="
SCREEN(Main,Left,0%),
SCREEN(Main,Top,0%),
SCREEN(Main,Width,-0%),
SCREEN(Main,Height,-7%)
">
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:
Timerbody {
}
h1 {
margin-top:0;
margin-bottom:0;
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.
no worries. I'll report back
Hi @Noob2this , I might not be the best person to answer this but I'll take a shot.
In the countdown timer macro, In the action labeled Custom Floating HTML Prompt, there is aline of text like
<body style="background: #ffd096" data-kmwindowid="Archive MD5 Tamper" data-kmwindow="SCREEN(Main,MidX) -940,SCREEN(Main,MidY)-800,120,55">
That is where you could change the display location.
#9c96ff is a purple color - you can change the color in that above line of code...
Not sure how to make it transparent, - I'd like to know that myself!
I hope this helps
thx troy. that was the other place I was looking at
I use the following code to make the countdown window appear at the bottom-left corner of my 2nd screen:
<body data-kmwindow="SCREEN(Front,Width),SCREEN(Back,Height),110,45">
I'm glad you figured it out. For the last half hour I've been working on another thread, and I didn't notice this conversation.
I just read this whole thread. It was a lot of code for a simple timer. And it got me to thinking. I now I have a great idea for a whole new type of timer. I'm going to work on it and post it as soon as I get it done.
mine is similar. I did 90% for both width and height. works great
@Martin: Thank you for the code, especially the combination with Alfred
.
Unfortunately the combination of Alfred
does not support a task name.
I have adapted the code from Martin and it now supports many ways to specify what you would like to do, including an optional task name and two time specification methods:
Example | Effect |
---|---|
30 | A timer of 30 seconds |
30 task | A timer of 30 seconds with the name task . |
task 30 | A timer of 30 seconds with the name task . |
3m | A timer of 3 minutes. A task name can be added before or after. |
2h3m | A timer of 123 minutes. A task name can be added before or after. |
2.5h | A timer of 150 minutes. A task name can be added before or after. |
1d3h5m10s | A timer of many minutes. A task name can be added before or after. |
If the task
is specified it will show up in the counter.
The zip
contains both a changed Alfred
workflow as well as an update Keyboard Meastro
macro.
If you run into unexpected behavior let me know.
Countdown Timer with Alfred.zip (84.3 KB)