What are the challenges doing data processing with Macrodroid?

sampleuserhere

Active member
I'm kind of a bit testing how far I could go with Macrodroid and would love to get used to with how stuff works around here. So far I've only ever done simple macros with this app.

I'm not that used to working with the syntax, tools, and actions altogether to process the data. So I'd like to ask what kind of existing challenges related to the topic that I could explore and maybe some assistances on how to solve the some challenges I've been struggling with.

Here's the challenges that I'm already settled with.

1. Combining two or more arrays without loop.

This is fairly easy.
  1. I just need to create a sequence number with 0 to {size=array} subtracted by 1 with seq in Shell Script.
  2. Replace the number with {lv=array 1[$0]}.
  3. Then as the final step, split the text with the divider.
  4. The final array should be automatically evaluated by Macrodroid.
This could be used to create various format just by replacing the replacer text.


Not settled yet

1. Creating multiple arrays from a text

This is a bit hard to deal with. My current approach is

  1. Match the full set of data with regex,
  2. Turns them into JSON arrays [{},{}].
  3. Parse them with JSON parse and use Macrodroid variable syntax to refer the values with their path.

Not really the way to go. While I could do them in one bulk, the data set should be identical and repetitive (like CSV) or else I have to form the regex very carefully. Obviously this is still very hypothetical, but I could foresee this one is not going to be conveniently applicable for most cases.


Anyway, Is there any I could extract the groups into multiple arrays? Say, I have the following regex.

Code:
(?<order>\d+):(?<name>[a-z]+)

It will match 1:ai and sets {lv=order[0]} to 1 and {lv=name[0]} to ai. This is the approach I usually do in Tasker, may be worth to ask this one just in case Macrodroid has similar tools that I'm not aware of.

2. Escaping newline and preserving escaped or literal newline

I look around and several people posted about this topic and it seems that most of them implied that Macrodrod will always try to convert \n to literal newline? Is this really the case with Macrodroid?

I realize the way Macrodroid handles newline seems a bit odd for some cases.
  1. Returning stdout that contains newline after executing Shell Script action.
  2. Entering newline in set variable action.
I tried escaping \\n, and \n still get converted nevertheless. How do I go about preserving both in Macrodroid? Is there a documentation or a couple of threads that I could read about this topic?


Other Challenges?

Do you guys have any other problem you have been struggling with until now?

Not saying I would and could definitely solve it. However there are challenges that could be encountered only by those who are already well-versed with Macrodroid. I'm still far miles away from that so I'd like to know some earlier if possible.

TIA.
 
Ran into the problem that macrodroid does not preserve newline in shell output variable this week. Two solutions : 1) shell instead output to a file then macrodroid reads from file. Newlines are preserved. 2) Shell command adds another character as newline delimeter. Shell outputs to a variable. Then macrodroid text manipulation, replace all change the character to newline in variable, if desired.
 
Top