Read last line of an array

Hi,

When i receive WhatsApp messages i want then to be read out loud when I'm in the car. But the problem is : first message is ok, but when i have at least another one i hear "2 new messages", whereas i want to hear the content of the second message (as well as the name of the sender, if it's possible).

So i succeeded in splitting each new message in an array but i don't know how to read only the last line of the array (the last message).

I tried to delete all but the last line of the array but I'm sure there is a simpler way to do this. Thank you
 

OscariBot

Active member
Why do you even need an array for such a simple task? except you want to keep track of those messages. the example below works for me. am using whatsapp business you can change it to your preferred whatsapp.

I hop this help
 

Attachments

  • Screenshot_20221026-052657.png
    Screenshot_20221026-052657.png
    55 KB · Views: 13

OscariBot

Active member
However here is another screenshot of how to read the last line of an array just in case it's so necessary for you.

I assumed you have already split your new messages into an array.
 

Attachments

  • test.mdr
    6.9 KB · Views: 5
Hi, thank you for your answers, but : as I wrote initially, [notification] doesn't say the content of the message, but it says, instead : "2 new messages", or "3 new messages" etc... It works for the first message but that's all.

As for your exemple, unfortunately it's not a screenshot : if I open it with MD it wants to replace all my macros, so i couldn't see your exemple.
 

OscariBot

Active member
Did i mention screenshot? sorry it's a macro

Just download it.
It's gona open with macrodroid but it will not replace your macros unless you hit the add (+) button. But then it's advisable to always save your macros... i don't even rely on auto-backup
 

Endercraft

Moderator (& bug finder :D)
Did i mention screenshot? sorry it's a macro

Just download it.
It's gona open with macrodroid but it will not replace your macros unless you hit the add (+) button. But then it's advisable to always save your macros... i don't even rely on auto-backup
It's in .mdr format
Here is the actual macro
Please export using share macro in the edit screen...
 

Attachments

  • read_last_array.macro
    3 KB · Views: 4
Top