PLUGIN: Format Elapsed Time - UPDATED v1.1


#1

#PLUGIN ACTION: Format Elapsed Time version 1.1

Requires OS/X Yosemite or later.

UPDATE: Version 1.1 now uses custom format strings.

Format Elapsed Time.v1.1.zip (6.2 KB)

Please see the Installation Instructions, below.

##PURPOSE:

Formats an elapsed time (milliseconds) for display purposes. Various formats are available, including custom formats.

(There’s an example further down in this post.)


###Elapsed Milliseconds:

Set this to the elapsed time in milliseconds.

This is a “calculation” field, so you can use math expressions and functions, and you can specify variables by just using their names (without the “%Variable%” formatting).


###Format:

Choose one of the pre-defined formats from the drop-down list, or choose “Custom” and enter your own format string in the “Custom Format” field.

Examples:

NOTE: I don’t do any validation on custom formats. Follow these rules, or I can’t guarantee what you’ll get:

  1. Starting from left-to-right, go from the largest value to the smallest value.
  • DO: hh:mm
  • DON’T DO: mm:hh
  1. Any characters not part of the list of validation characters are displayed literally. So you don’t have to use colons and periods if you don’t want to.
  2. Remainders are always rounded to the nearest whole number.

###Output:

Choose what you want to do with the output, such as having the result displayed in a window, storing it in a variable, etc.


##Example:

Format Elapsed Time Example Macros.v1.1.kmmacros (8.7 KB)


#INSTALLATION INSTRUCTIONS

##First-time Installation:

  1. Download the ZIP file (in the link at the top of this post).
  • DO NOT UNZIP IT.
  1. Make sure the Keyboard Maestro Editor is running.
  2. Drag and drop the ZIP onto the Keyboard Maestro icon in the Dock.

Assuming you did this correctly, the plugin should be installed, and available just like any other Action. If not, follow the next steps, for “Updating an Existing Plugin”.

##Updating an Existing Plugin:

  1. Download the ZIP file (in the link at the top of this post).
  • Go ahead and unzip it.
  • It should create a folder named “Format Elapsed Time”.
  1. In the Keyboard Maestro Editor, click the “Help” menu item, and select “Open Preferences Folder”.
  2. In the Finder window that opens up, go into the “Keyboard Maestro Actions” folder.
  3. If you have an existing “Format Elapsed Time” folder there, delete it.
  4. Copy/Move the folder “Format Elapsed Time” that you got from the ZIP file in step #1 to the “Keyboard Maestro Actions” folder.
  • Don’t just drag the folder’s contents - drag the entire “Format Elapsed Time” folder.
  1. Stop and Restart the Keyboard Maestro Engine:
    a) In the Editor, click File->Quit Engine, then File->Start Engine.

Less-than-10 MOD formatting puzzle
Duration using MOD, but keeping 00.000 formatting
#2

all I can say is ~ awesome Dan ~