Get current location
Reads the Mac's current latitude, longitude and accuracy from Location Services.
Get the current location into into
Keyboard Maestro: GetLocation
Details #
Asks macOS where the Mac is and waits for a fix. The output is an object with latitude, longitude and accuracy (the accuracy in metres).
If you give into, it also sets these variables. With into set to here:
here: the textlatitude,longitude, like51.5007,-0.1246.hereLatitude,hereLongitude: numbers.hereAccuracy: a number, in metres.
The note of the step is the same latitude,longitude text.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
into | text | The variable name, or prefix, as described above. | ||
timeout | number | How many seconds to wait for a location. The default is 10. It is held to at least 1 and to at most 1 second under the step's own timeout. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Get the current location
- Show “At {{hereLatitude}}, {{hereLongitude}} (within …” for 4 s
Gotchas #
If no location arrives in time, the step fails with "the Mac didn't report a location within N s". Steps have a 10 second timeout unless you set one, which also limits the wait, so raise the step's
timeoutalong withtimeoutwhen a fix is slow.Check
accuracybefore relying on a result; it is the error radius in metres.In a dry run the step is simulated and
intois set to empty text and the other variables are not set.