QA Graphic

Milliseconds to Seconds Converter

Quickly calculate Milliseconds to Seconds

This is a quick Macro that will activate when I need to convert the number on the clipboard (Milliseconds) to seconds.

In Action...

I simply select the value, then type in my trigger action keys: .mill then the value gets typed in.

So 23893 will become 0:24 - you can configure this so that it can output whatever format works for you.

Keyboard Maestro Script

Milliseconds

The Javascript that I used for the calculations:

var app = Application.currentApplication()
app.includeStandardAdditions = true
 
var kmInst = app.systemAttribute("KMINSTANCE");
var kmeApp = Application("Keyboard Maestro Engine")
 
var myLocalVar = kmeApp.getvariable("Local__MyVar",  {instance: kmInst});
kmeApp.setvariable("Local__FromJXA", {instance: kmInst, to: "Set in JXA Script"})
function millisToMinutesAndSeconds(millis) {
  var minutes = Math.floor(millis / 60000);
  var seconds = ((millis % 60000) / 1000).toFixed(0);
  return minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
}
millisToMinutesAndSeconds(myLocalVar); // "4:59"

 

About

These posts showcase some excellent examples of why Keyboard Maestro is a must-have for every Mac OS user. As a powerful automation tool, Keyboard Maestro helps boost productivity, save time, and streamline repetitive tasks. With its vast array of customizable features and functions, it's the perfect choice for Mac OS users seeking to optimize their workflow.

Schedule

WednesdayAffinity
ThursdayBBEdit
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
MondayMedia Monday
TuesdayQA