Trigger needed...

hendis

Member
Sometimes, I feel like I have just heard about MD for the first time...

Anyhow, here's my question: I want to flip a variable to true (or use a constraint, etc.) so that a macro can only run if I am about 10 miles from point X.

Unfortunately, while the idea is great, actually coding it is another thing.

Does anybody have an idea as to how I can code this?

Thanks to all!
 

hendis

Member
EDIT -
My brain is leaning toward a solution involving how long my phone has been continuously connected to my car's Bluetooth. After all, if the distance involved is approximately 10 miles, I would obviously be driving, and my car has Bluetooth.
 

Dev777

Active member
This macro can help you with that. Get your current latitude and longitude and get distance from the point X.
Then toggle another boolean variable depending on whether the distance is greater than or less than 10 miles and use the variable as your constraint or trigger.

 
Last edited:

Dm114

Well-known member
Sometimes, I feel like I have just heard about MD for the first time...

Anyhow, here's my question: I want to flip a variable to true (or use a constraint, etc.) so that a macro can only run if I am about 10 miles from point X.

Unfortunately, while the idea is great, actually coding it is another thing.

Does anybody have an idea as to how I can code this?

Thanks to all!
Why don't you use Geofence or Location triggers?
 

hendis

Member
This macro can help you with that. Get your current latitude and longitude and get distance from the point X.
Then toggle another boolean variable depending on whether the distance is greater than or less than 10 miles and use the variable as your constraint or trigger.

Dev777,

Is there a way that I would not be required to get one of the coordinate sets? Would I be able to use "My Current Location" instead and automagically write this data into the action block?

hendis
 

Dm114

Well-known member
Dev777,

Is there a way that I would not be required to get one of the coordinate sets? Would I be able to use "My Current Location" instead and automagically write this data into the action block?

hendis
In my Macro/Action block it's quite possible.
 

Dm114

Well-known member
I apologize. I should be able to figure this out.

Could you please show me how?
Very simple: see below (of course GPS must be on) 😉

Just replace the 1st Input parameter (0,0) by your destination location and you'll get the distance in the local decimal variable.

For some reason, another app using GPS (such as Waze) must be running if you can't get Magic Text location. ☹️

Enjoy! 20240321_072724.jpg20240321_072654.jpg
 

Dm114

Well-known member
Be aware that the calculated distance is as the crow flies (straight line). So the real distance by road must be greater and you could multiply the result by a coefficient (maybe something between 1.25 to 1.5 depending on the turns on the route) to get a distance closer to the real one...
 

mapriex

Active member
Because the max geofence radius is much less than 10 miles.

(Actually, on my phone, it automatically reduces itself to a max radius of about 5000 meters.)

hendis
with exporting macro and open this with a text editor, you can add custom distances like i did and then import the macro again:

max. distance to select in the app is 5 000 meters, if you watch the screenshot i use 13 000 meters.

its a trigger, if i get out of this and turn on my motor my NAVI leads me automatically home, except i deny the automation during the initialising process.
 

Attachments

  • Screenshot_20240321-213323.png
    Screenshot_20240321-213323.png
    398.7 KB · Views: 5
Top