Send GPS Location X (Variable?) Times from SMS?

Lewis8973

New member
I would like to be able to specify a number in the trigger text to be able to send that many GPS updates a minute apart.

I.e. if I text @TRACK10@, it will run through through actions to wait a minute and send a GPS update 10 times.

I got the SMSTriggerCharacter variable to work perfectly but not so sure on this one. As you can see I created a local variable and put it in the SMS trigger. Not sure if a text would correctly set that local variable yet.

When it does, I'm confused on how I can make it work within the actions. I had a look around the Repeat Actions action under Conditions/Loops which appears to be what I'm looking for, but when running through the options I can't figure out how I can make it repeat the number of the local variable set in the SMS trigger. Even then I also don't understand how I need to set the repeat action to only repeat the wait and send location and not the entire list of actions.

Am I doing something wrong?

Thank you

Screenshot_20211016-054204_MacroDroid.jpg
 

FrameXX

Well-known member
This may be what you want. I would rather use a sent sms action rather than share location, as you can more customize what exactly sent. I don't know what share location action actually sends.

Test.jpg
 
Last edited:

Lewis8973

New member
This may be what you want. I would rather use a sent sms action rather than share location, as you can more customize what exactly sent. I doN¨t know waht share location action actually sends.

View attachment 1268
That looks promising, I'll give that a go, thanks. But for now, I can't see to get the trigger working.

My trigger is [v=SMSTriggerCharacter]TRACK[lv=TrackingSMSAmount][v=SMSTriggerCharacter]

The trigger character bit works fine on other macros but with that trigger I'd expect to type #TRACK4# and have the actions loop 4 times, but the macro isn't starting at all with that example. Hmm.
 

420

Active member
That looks promising, I'll give that a go, thanks. But for now, I can't see to get the trigger working.

My trigger is [v=SMSTriggerCharacter]TRACK[lv=TrackingSMSAmount][v=SMSTriggerCharacter]

The trigger character bit works fine on other macros but with that trigger I'd expect to type #TRACK4# and have the actions loop 4 times, but the macro isn't starting at all with that example. Hmm.
I think it is because your "TrackingSMSAmount" variable can be at a completely different number then what is send in the SMS, so it doesn't match..
 

420

Active member
I think it is because your "TrackingSMSAmount" variable can be at a completely different number then what is send in the SMS, so it doesn't match..
I think if you replace [lv=TrackingSMSAmount] with (\d+) it will work, this will match any digit. (don't forget to enable regular expression matching)
 

Lewis8973

New member
I think it is because your "TrackingSMSAmount" variable can be at a completely different number then what is send in the SMS, so it doesn't match..
Hmm I'm getting a bit confused on how I can translate a number in the SMS in to having the actions repeat that amount of times

I tried the SMS trigger of:
[v=SMSTriggerCharacter]TRACK\d+[v=SMSTriggerCharacter]

But the result didn't work properly:

Screenshot_20211016-151025_MacroDroid.jpg
 

420

Active member
Hmm I'm getting a bit confused on how I can translate a number in the SMS in to having the actions repeat that amount of times

I tried the SMS trigger of:
[v=SMSTriggerCharacter]TRACK\d+[v=SMSTriggerCharacter]

But the result didn't work properly:

View attachment 1269
I can understand that, since it wasn't included in FrameXX's example.. you would have to extract it from the SMS content..

Use text manipulation - extract text - source text = [sms_message] - text to match = (\d+) - save to a variable

Now this can only save to a string variable so you will need another action to set your integer variable to the string variable value..

PS; you need to put the ( and ) around the \d+, so it's litteraly (\d+) although from your screenshot it looks like the trigger actually fired.. i'm not sure what is going on here.
 

Attachments

  • Screenshot_20211016-162627.png
    Screenshot_20211016-162627.png
    127 KB · Views: 13
  • Screenshot_20211016-162559.png
    Screenshot_20211016-162559.png
    141.4 KB · Views: 12
  • Screenshot_20211016-162618.png
    Screenshot_20211016-162618.png
    175.9 KB · Views: 13

Lewis8973

New member
I can understand that, since it wasn't included in FrameXX's example.. you would have to extract it from the SMS content..

Use text manipulation - extract text - source text = [sms_message] - text to match = (\d+) - save to a variable

Now this can only save to a string variable so you will need another action to set your integer variable to the string variable value..

PS; you need to put the ( and ) around the \d+, so it's litteraly (\d+) although from your screenshot it looks like the trigger actually fired.. i'm not sure what is going on here.

Thank you all for your help, but that message really sealed the deal and it now works as I was hoping! No wonder why I needed help though, the variables system is very complex and detailed!

The Share Location action replies with a Google Maps link and works fine for this use case :D

Screenshot_20211017-165557_MacroDroid.jpg

So to clarify what is going on here so I can understand it:

1) The (\d+) is effectively a placeholder

2) The extract text is looking for and will take out whatever is in that placeholder, as shown in the "Text to match (regex)" box, and puts it in the set variable... but this variable is a "string" (text?) which isn't compatible with being able to count down on each loop

3) The Set Variable takes the "string" and puts it in to a different "integer" (numbers) type of variable so that the action 5 below below can manipulate it

4) The loop is set to only repeat when the new integer variable is above 0

5) The Set Variable in the loop can take the integer figure and can change the value in different ways that it couldn't with a "string" value

Have I got that right?

Thank you again for everyones help, I'll have a look at sharing this to the Templates store at some point and will mention everyones usernames from here in the description. (y)(y)(y)(y)
 

FrameXX

Well-known member
I don't know what's your exact usecase, but I would recommend using webhooks if you have mobile data. Webhooks eat only small amount of data and are propably cheaper than SMS.
 

Lewis8973

New member
I don't know what's your exact usecase, but I would recommend using webhooks if you have mobile data. Webhooks eat only small amount of data and are propably cheaper than SMS.
That'll be something for me to experiment with another day, but when my phone as internet, I can use the Google or Samsung Find My Phone tools to track the phone. While I personally do have backup access codes stuck on the back of a card in my wallet so I can access both accounts without two factor authentication, my passwords are 20 characters and randomly generated in a password manager, so it would be impractical to track my phone quickly with those tools on, let's say, a kind strangers phone. Webhooks are a bit above me for the moment while I get comfortable.

Where this macro really comes in, is if my phone didn't have internet but still had the SIM card in, this macro will still work as GPS doesn't require or use an internet connection. It's just a nice added layer of protection and is much quicker to use without too much complexity! :D

I'll have a play around with Webhooks at some point but I'm still happy with how this works for now! The macro is now on the templates store where I thank both you and 420 for making it possible :)
 

420

Active member
Thank you all for your help, but that message really sealed the deal and it now works as I was hoping! No wonder why I needed help though, the variables system is very complex and detailed!

The Share Location action replies with a Google Maps link and works fine for this use case :D

View attachment 1277

So to clarify what is going on here so I can understand it:

1) The (\d+) is effectively a placeholder

2) The extract text is looking for and will take out whatever is in that placeholder, as shown in the "Text to match (regex)" box, and puts it in the set variable... but this variable is a "string" (text?) which isn't compatible with being able to count down on each loop

3) The Set Variable takes the "string" and puts it in to a different "integer" (numbers) type of variable so that the action 5 below below can manipulate it

4) The loop is set to only repeat when the new integer variable is above 0

5) The Set Variable in the loop can take the integer figure and can change the value in different ways that it couldn't with a "string" value

Have I got that right?

Thank you again for everyones help, I'll have a look at sharing this to the Templates store at some point and will mention everyones usernames from here in the description. (y)(y)(y)(y)
1) Not sure what you mean by that :ROFLMAO: :ROFLMAO: placeholder for what? It is a regular expression (i don't know a whole lot about this subject myself) you can have a look at regex101.com if you want to learn more about it, that is what i've been using.

2) Is this a question or are you telling me? :p you are correct about everything!

3) Correct again!

4) And again!

5) And again!!!!!

You got everyhing right! (y)(y)
 

420

Active member
Thank you all for your help, but that message really sealed the deal and it now works as I was hoping! No wonder why I needed help though, the variables system is very complex and detailed!

The Share Location action replies with a Google Maps link and works fine for this use case :D

View attachment 1277

So to clarify what is going on here so I can understand it:

1) The (\d+) is effectively a placeholder

2) The extract text is looking for and will take out whatever is in that placeholder, as shown in the "Text to match (regex)" box, and puts it in the set variable... but this variable is a "string" (text?) which isn't compatible with being able to count down on each loop

3) The Set Variable takes the "string" and puts it in to a different "integer" (numbers) type of variable so that the action 5 below below can manipulate it

4) The loop is set to only repeat when the new integer variable is above 0

5) The Set Variable in the loop can take the integer figure and can change the value in different ways that it couldn't with a "string" value

Have I got that right?

Thank you again for everyones help, I'll have a look at sharing this to the Templates store at some point and will mention everyones usernames from here in the description. (y)(y)(y)(y)
Just some advice, i would re-configure the "clear notifications" action so it only deletes the notification that contains your trigger text (i forgot what it was exactly, but you can just copy it from your trigger), the way it is setup now it deletes all notifications from your messages app, so you might miss some important messages.
 
Top