Comparing Action Blocks to Macros

In the course of working with my programmer friend who doesn't like to download apps, he asked me what the distinction was between MD macros and the relatively new action blocks option. Figured the best way to answer that was with a table. Didn't really take me long.

A MacroAn Action Block
Has a disabling switch?YesNo
Can be categorized?YesNo
Has a trigger component? YesNo
Triggers can be constrained individually? Yesn.a.
Has an action set component? YesYes
Actions can include “Wait For Trigger?” YesYes
Actions can be grouped into condition sets? YesYes
Actions can be constrained individually? YesYes
Has a constraint set component to apply to all actions? YesNo
Can read & edit global variables? YesYes
Can include local variables? YesNo
Can include input variables? NoYes
Can include those new “working variables?” NoYes
Can include output variables?NoYes

He told me we could sum it up this way. "Macros are programs. Action blocks are functions."

Suggestions welcome for additions and edits to the table. I don't mind if someone puts the table on the Wiki. I may do it myself since I'm a prospect for access to the Wiki.
 

Josué García

MacroDroid Support
Staff member
In the course of working with my programmer friend who doesn't like to download apps, he asked me what the distinction was between MD macros and the relatively new action blocks option. Figured the best way to answer that was with a table. Didn't really take me long.

A MacroAn Action Block
Has a disabling switch?YesNo
Can be categorized?YesNo
Has a trigger component?YesNo
Triggers can be constrained individually?Yesn.a.
Has an action set component?YesYes
Actions can include “Wait For Trigger?”YesYes
Actions can be grouped into condition sets?YesYes
Actions can be constrained individually?YesYes
Has a constraint set component to apply to all actions?YesNo
Can read & edit global variables?YesYes
Can include local variables?YesNo
Can include input variables?NoYes
Can include those new “working variables?”NoYes
Can include output variables?NoYes

He told me we could sum it up this way. "Macros are programs. Action blocks are functions."

Suggestions welcome for additions and edits to the table. I don't mind if someone puts the table on the Wiki. I may do it myself since I'm a prospect for access to the Wiki.

this is pretty cool, i'll take it to the wiki when i get off work
 

Josué García

MacroDroid Support
Staff member
In the course of working with my programmer friend who doesn't like to download apps, he asked me what the distinction was between MD macros and the relatively new action blocks option. Figured the best way to answer that was with a table. Didn't really take me long.

A MacroAn Action Block
Has a disabling switch?YesNo
Can be categorized?YesNo
Has a trigger component?YesNo
Triggers can be constrained individually?Yesn.a.
Has an action set component?YesYes
Actions can include “Wait For Trigger?”YesYes
Actions can be grouped into condition sets?YesYes
Actions can be constrained individually?YesYes
Has a constraint set component to apply to all actions?YesNo
Can read & edit global variables?YesYes
Can include local variables?YesNo
Can include input variables?NoYes
Can include those new “working variables?”NoYes
Can include output variables?NoYes

He told me we could sum it up this way. "Macros are programs. Action blocks are functions."

Suggestions welcome for additions and edits to the table. I don't mind if someone puts the table on the Wiki. I may do it myself since I'm a prospect for access to the Wiki.
Right now this should be visible on the wiki
 

FrameXX

Well-known member
Action blocks are like functions in coding. They are reusable usually more generic actions that you can make use of in multiple macros. For example the "Whatsapp send" action in MacroDroid could be also created as an action block containing set of more generic actions - in this case it would be mostly UI interactions.

One important quality that action blocks have different from macros is that every action block runs in its own thread and has its own copy of variables that are unique to that run of the action block.

For example you have a macro that after triggered makes a HTTP requests to multiple URLs, then waits until response is returned, parses the returned data and posts a notification. With simple macro you would have do these actions for every URL one by one in a loop, but if you place an action block with the very same actions into the same position and just uncheck "wait until action block ends" and it will instead start to run HTTP request (which can take a longer time (is asynchronous)) and then the parsing and posting in its own thread thus not blocking the main thread which can immidiately start another action blocks in their own threads etc... you will end up with MacroDroid doing all you wanted for every URL all at once and much faster.
 
Last edited:

Endercraft

Moderator (& bug finder :D)
Actions can include “Wait For Trigger?”
This is not supported in action blocks, but you can use an if to put one in anyway.
Can include those new “working variables?”
Working variables are local variables (they act like local variables except they're not kept when action block ends).
He told me we could sum it up this way. "Macros are programs. Action blocks are functions."
Exactly.
 

OscariBot

Active member
From the very first day ACTION BLOCK was included in macrodroid till date I still hav not found a significant reason I should use it in place of RUN MACRO action.

I can't seems to see anything unique abt it and why I shud use it in place of RUN MACRO action.

Maybe am myopic here.
Can someone tell me very outstanding reason to use ACTION BLOCK or perhaps is there anything ACTION BLOCK can do and MACRO cannot do?

Just curious
 

Endercraft

Moderator (& bug finder :D)
From the very first day ACTION BLOCK was included in macrodroid till date I still hav not found a significant reason I should use it in place of RUN MACRO action.

I can't seems to see anything unique abt it and why I shud use it in place of RUN MACRO action.

Maybe am myopic here.
Can someone tell me very outstanding reason to use ACTION BLOCK or perhaps is there anything ACTION BLOCK can do and MACRO cannot do?

Just curious
From the very first day ACTION BLOCK was included in macrodroid till date I still hav not found a significant reason I should use it in place of RUN MACRO action.

I can't seems to see anything unique abt it and why I shud use it in place of RUN MACRO action.

Maybe am myopic here.
Can someone tell me very outstanding reason to use ACTION BLOCK or perhaps is there anything ACTION BLOCK can do and MACRO cannot do?

Just curious
Well, for example you can create an action block to convert temperatures, or distances.
 

Dm114

Well-known member
From the very first day ACTION BLOCK was included in macrodroid till date I still hav not found a significant reason I should use it in place of RUN MACRO action.

I can't seems to see anything unique abt it and why I shud use it in place of RUN MACRO action.

Maybe am myopic here.
Can someone tell me very outstanding reason to use ACTION BLOCK or perhaps is there anything ACTION BLOCK can do and MACRO cannot do?

Just curious
You're not totally wrong. It was really similar to a Run macro action at the very beginning.

But Jamie improved these Action blocks so much that it's now much more convenient to use them rather than Run macro actions. Mainly (but not only) according to privacy of variables inside Action blocks: you must not use only global variables to pass values to an independent macro and spoil global variables area with variables that become useless once calling macro has finished... 😉
 

Dm114

Well-known member
Well, for example you can create an action block to convert temperatures, or distances.
I wouldn't say that unless this "module" (Action block) is about to be called from several macros, not just one. Otherwise, you'd better use a regular macro to make these conversions.

I made one (in the store) a long time ago and improved it for my personal use. I'll try to update it in the store if you are interested.
 

OscariBot

Active member
You're not totally wrong. It was really similar to a Run macro action at the very beginning.

But Jamie improved these Action blocks so much that it's now much more convenient to use them rather than Run macro actions. Mainly (but not only) according to privacy of variables inside Action blocks: you must not use only global variables to pass values to an independent macro and spoil global variables area with variables that become useless once calling macro has finished... 😉
I wish I understand anything he's saying 🧐
 

OscariBot

Active member
Link please... I really need to see this action block in action.... I want to b sure there is something really unique about it that macro can't do.

I hav been using run macro for all my complex action and each time I see this action block I keep wondering is there something really unique?
 

Endercraft

Moderator (& bug finder :D)
Link please... I really need to see this action block in action.... I want to b sure there is something really unique about it that macro can't do.

I hav been using run macro for all my complex action and each time I see this action block I keep wondering is there something really unique?
At first I was like you, 'I don't see the point ?'
At some point I started using them because I noticed they were actually useful, and started using them. But, action blocks are not just used as functions, they're a playground to hunt bugs and to develop workarounds ;)
 

Qarboz

Well-known member
My opinion is that action blocks are handy if you have to repeat the same actions multiple times (with or without different data) within the same macro or in different macros.
E.g. you can create a vibration pattern in an action block and call it from various macros instead of rewriting the same things several times (with the risk of errors; also, if you make a change automatically it is already present in all macros that use that action block!). You can also create it with input variables to determine (eg) duration and speed.
But the possibilities are much greater
 

OscariBot

Active member
My opinion is that action blocks are handy if you have to repeat the same actions multiple times (with or without different data) within the same macro or in different macros.
E.g. you can create a vibration pattern in an action block and call it from various macros instead of rewriting the same things several times (with the risk of errors; also, if you make a change automatically it is already present in all macros that use that action block!). You can also create it with input variables to determine (eg) duration and speed.
But the possibilities are much greater
Hahaaaa same thing can be done by writing a single macro and using RUN MACRO action to run it from all ur macros.

Maybe I should narrow my question to.... What can ACTION BLOCK do that MACRO can't do?

I have played with action block but still have not seen anything unique.
 

Endercraft

Moderator (& bug finder :D)
Hahaaaa same thing can be done by writing a single macro and using RUN MACRO action to run it from all ur macros.

Maybe I should narrow my question to.... What can ACTION BLOCK do that MACRO can't do?

I have played with action block but still have not seen anything unique.
Input/output variables.
 

Endercraft

Moderator (& bug finder :D)
The thing is you may not use action block for their purpose? but some do. I don't (fully) use action blocks for their purposes of being like functions, I use them as workarounds and for experimenting.
Yep, the same thing that had (fixed, for now...) potential to crash anybody on run, and (still has) potential to... do something unwanted.
 

Dimlos

Well-known member
If you want to use action blocks, use them, if you don't want to use them, don't use them. I am not familiar with action blocks either, but I have been looking at other people's macros and I am slowly getting the hang of it.

In my opinion, it is a good thing that we no longer have to write long, vertical macros as we did before.
 

Dm114

Well-known member
Hahaaaa same thing can be done by writing a single macro and using RUN MACRO action to run it from all ur macros.

Maybe I should narrow my question to.... What can ACTION BLOCK do that MACRO can't do?

I have played with action block but still have not seen anything unique.
I would say that the main difference is the way to pass variables. To pass variables from macro to macro, you must use global ones. With action blocks they can be local.

The inconvenience with global variables (which I'm still using for some purpose) is that either you have specific names depending on macros using them, i.e. you must declare and store a lot a variables Or you use a smaller number depending in their type (integer, decimal, string, arrays...) shared by all the macros but if several macros running at the same time use same variables, the values won't be reliable...

Action blocks are not more powerful but just more convenient is some cases.
 

OscariBot

Active member
@Dimlos you have made one point about the uniqness of action block (To pass variables from macro to macro, you must use global ones. With action blocks they can be local).... This seems to be the only unique feature that might attract me to use it to reduce the number of my global variable.

Thanks

Please don't fail to update me if u found more unique features
 
Top