PLUGIN: Stopwatch (Elapsed Time Calculator)

Plug In Actions Action: Stopwatch (Elapsed Time Calculator)

Requires OS/X Yosemite or later.

Stopwatch.v1.0.zip (7.5 KB)

Please see the Installation Instructions, below.

##PURPOSE:
This plugin acts pretty-much just like a typical stopwatch. Use it to calculate the elapsed time of various events, including how long a macro (or part of a macro) takes to run.

##The Stopwatch Variable
Each time you use a Stopwatch action, you specify the name of a variable that the Stopwatch uses to store its information.

Use this same Stopwatch Variable in another Stopwatch action, and the action will be able to determine the elapsed time, whether the Stopwatch is running, etc.

If you want to run multiple Stopwatches simultaneously, simply use different variables.

##The Actions

The Stopwatch plugin has an "Action" property:

##Elapsed Time Format
"Elapsed Time" is NOT a date or time. In other words, there's no 12- or 24-hour versions, there's no month-day-year values, etc. It just represents the amount of time that has elapsed.

  • So if you see a value like "101:59.789", it means "101 minutes, 59 seconds, and 789 millieconds".
  • Likewise, "342.23.59.789" means "342 hours, 23 minutes, 59 seconds, and 789 milliseconds".

You can choose from various formats for the Elapsed Time.

  • The left-most portion will contain as many digits as necessary to convey the value.
  • All other portions are padded with leading 0, if needed.
  • Colons (":") separate all portions except for milliseconds, which are separated by a period.
  • All formats that don't show milliseconds are rounded up to the nearest second.

##Output

Each Stopwatch action produces the elapsed time as its output. Choose where the output should go, including into a variable, display in a window, ignored, etc.


##Notes:

Executing the Stopwatch action is not instantaneous. It adds a small overhead to the elapsed time. Depending on your system, it could be 100-200 milliseconds. So take this into account when looking at the results.


#example Macros

Here's a couple of example macros. Install them after you install the plugin (see "Installation Instructions", below). Try them out, and you can delete them when you don't need them anymore.

Stopwatch Example Macros.kmmacros (23.2 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 "Upating 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 "Stopwatch".
  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 "Stopwatch" folder there, delete it.
  4. Copy/Move the folder "Stopwatch" 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 "Stopwatch" folder.
  1. Stop and Restart the Keyboard Maestro Engine:
    a) In the Editor, click File->Quit Engine, then File->Start Engine.
2 Likes

Thank you! Old post, but still useful!