Action Blocks

I was reading the MacroDroid Wiki and I ran across Action Blocks. Just when I was thinking of how I was going to implement functions in MacroDroid, apparently they already have a way of doing it. For the life of me, I cannot find the panel or home screen for this, or how to create action blocks. Useful help would be greatly appreciated.
 

Josué García

MacroDroid Support
Staff member
I was reading the MacroDroid Wiki and I ran across Action Blocks. Just when I was thinking of how I was going to implement functions in MacroDroid, apparently they already have a way of doing it. For the life of me, I cannot find the panel or home screen for this, or how to create action blocks. Useful help would be greatly appreciated.
This is coming to macrodroid soon...
 

Qarboz

Well-known member
Awesome!
This is the type of programming I use in PLCs (object-oriented programming).
Very good feature!
 

Josué García

MacroDroid Support
Staff member
I was reading the MacroDroid Wiki and I ran across Action Blocks. Just when I was thinking of how I was going to implement functions in MacroDroid, apparently they already have a way of doing it. For the life of me, I cannot find the panel or home screen for this, or how to create action blocks. Useful help would be greatly appreciated.
Action blocks and more new actions are now available in the new beta, now available on google play.
 

tanutanu

Well-known member
Action blocks and more new actions are now available in the new beta, now available on google play.
Got it now:love: Thanks for your great effort, Jamie:)
I would like to request just one thing, a cooy and paste feature to be easy to move from/to a regular macro action/constant, @MacroDroidDev:)

EDITED: I got how to copy and paste a if block from a normal macro. Adding a dummy statement once and paste a if block is working to do it(y) It would be better the "paste" toolbox button is added on the top of Actions field next to "reorder".

It doesn't seem to have its own local variables, so it would be better to access to global variables from the top right ... menu as a regular macro can.

Action blocks import/export feature is also helpful, especially transport from a macro. I noticed the data structure was same as regular macri basically, and seemed easy to identity by the member variable, isActionBlock. I can export it via my extractor but no way to import it.

I hope you have a plan to add above features to the next bata or public release:)
 
Last edited:

MacroDroidDev

Administrator
Staff member
Just to confirm that action blocks is currently only in the beta and this may not yet be available to all beta users. There were massive changes required to support action blocks and other significant changes in this release so I am treading carefully with this.

I will certainly consider all feature requests for action blocks, but they may have to wait until the next release depending on priorities as I don't want to delay a full release rollout for too long.
 

MacroDroidDev

Administrator
Staff member
@tanutanu You can sort of "abuse" output variables if you just want to use a temporary local variable for some calculations (and just never use the output value when calling it). The important thing to note is that each action block instance runs in isolation so there is no support for a local variable shared across instances of an action block type.
 

tanutanu

Well-known member
@tanutanu You can sort of "abuse" output variables if you just want to use a temporary local variable for some calculations (and just never use the output value when calling it). The important thing to note is that each action block instance runs in isolation so there is no support for a local variable shared across instances of an action block type.
Yes, I got it(y) it's actually for temporary use as you read my mind;)
The isolation of each action block call is what I expected. I wish the local variables in Action blocks would be also isolated by the instance though. It's ok, I "abuse";)
Thank you for your breakdown:)
 
Last edited:

Dm114

Well-known member
Nice job @MacroDroidDev with Action Blocks! As previously requested I guess you'll add to your ToDo list a copy/paste function to copy actions from a standard macro to a new ActionBlock.

Is this new functionality very different from a "standard macro" called by 'Macro Run' action with 'Block next actions untill complete' option selected? It's what I currently use in several 'calling macros' and it works fine like a "called function" (with global variables as input/output parameters).
 

dhj49er

Well-known member
.....I guess you'll add to your ToDo list a copy/paste...m

I do hope so, as I have a macro with over 25 actions that I would like to try as an action block. However, I'm not going to re-input allthe actions from the macro into a new action block.
I have other macros with sets of actions that are candidates for action blocks, but not if I have to re input all the actions.
 

tanutanu

Well-known member
.....I guess you'll add to your ToDo list a copy/paste...m

I do hope so, as I have a macro with over 25 actions that I would like to try as an action block. However, I'm not going to re-input allthe actions from the macro into a new action block.
I have other macros with sets of actions that are candidates for action blocks, but not if I have to re input all the actions.
Add a dummy action and paste a if block via context menu, then delete the dummy. It's the best way at this moment.
 

MacroDroidDev

Administrator
Staff member
Nice job @MacroDroidDev with Action Blocks! As previously requested I guess you'll add to your ToDo list a copy/paste function to copy actions from a standard macro to a new ActionBlock.

Is this new functionality very different from a "standard macro" called by 'Macro Run' action with 'Block next actions untill complete' option selected? It's what I currently use in several 'calling macros' and it works fine like a "called function" (with global variables as input/output parameters).

It's actually similar in many ways, but this is simply a cleaner way of doing it and more accessible for new users to understand. Yes I shall definitely be looking at ways to copy functionality from an existing macro to action block.
 

MacroDroidDev

Administrator
Staff member
The next beta will allow basic copying of actions from a macro to an action block. I will work on a way to extract multiple actions directly into an action block. Depending how things pan out this will either be in the full production release or will be in the release after.
 

Dm114

Well-known member
It's actually similar in many ways, but this is simply a cleaner way of doing it and more accessible for new users to understand. Yes I shall definitely be looking at ways to copy functionality from an existing macro to action block.
Thanks for your answer.
According to copy/paste functionality I don't know if you are thinking about something sophisticated (as to copy/paste part of a macro instead of individual actions for instance). As we all are already used to copy/paste a group of actions in a (dummy) loop or 'If clause', this will be enough, in my opinion (as for standard macros).
 

Dm114

Well-known member
The next beta will allow basic copying of actions from a macro to an action block. I will work on a way to extract multiple actions directly into an action block. Depending how things pan out this will either be in the full production release or will be in the release after.
Hope it won't be too much time consuming for you...
 

tanutanu

Well-known member
I was busy implementing this yesterday and I have a first cut ready today. I'm going to push a new beta out soon and hopefully this will be released today.
I got v5.20.3 now and noticed Extract to Action Block context menu to transfer a chunk of multi action statements.
Thanks for the rapid iteration to implement the amazing feature:) I love it:love:
I hope it as a part of preparation of multi statements copy and paste feature;)
 

Attachments

  • Screenshot_20211224-192944~2.png
    Screenshot_20211224-192944~2.png
    90.4 KB · Views: 18
Last edited:
Top