Custom Events

FrameXX

Well-known member
So what if I want to trigger some macro from another macro? Or even better what if I want to trigger macro after tapping on notification?

Well I can use the run macro action in both cases of course, which doesn't allow me to attach any further arguments. I can only pass arguments by messing up with global variables.

If I just want to trigger some macro from another macro and don't care about the notification I can broadcast intent and have a trigger in second macro. Here I can also pass arguments!

I talked about this here.

But what about the notification where I can only trigger certain macro or action block without any arguments whatsoever?

I think I have an idea for solution.

The setup of the action would allow user to add a custom event/trigger that would fire on certain event happening to the object (notification). Click for example.

Every event would have its id and n number of arguments defined by the user of course with ability to use magic text especially local variables.

Custom event would be a regular trigger availible to all macros similiar to intent trigger in configuration.

Why I think this is a good idea:

✅ Can be used for any possible trigger that is configured by in-macro action like floating button, floating text or notification. No need for developer to make a new extra trigger for every kind of object.

✅ Additional arguments are supported.

✅ Can be used as better alternative for run macro action.

✅ Can directly trigger several macros at once.
 
Last edited:

FrameXX

Well-known member
I need to note on one thing.

Sometimes it could happen that the user would want to to fire the event with current values of variables as arguments, but sometimes he/she might want to use the values in state that they were while running the action.

In this case the developer could add an option to update or not update the variables in argument upon firing the event. I understand this is unnecessarily difficult to implement for developer and the user would do the best if he/she would use MacroDroid array functionality and then remove the index from array after it was used.

To give an example my MD forum RSS track macro posts a notification for every new posts and of course most convinient for me would be to assing only the current value of string containing the link to the post and don't update the argument when event was fired and keep the link as it was designed. This of course might not be always what you want.

In this case I would do better by creating an array where the values won't get overwritten, but just stack on each other and when the event fires the link from array assigned by the argument is used and then can be removed from the array.

The fact that MacroDroid doesn't move indexes when item from an array is removed becomes actually useful here, because the indexes for rest of the links stay same.

So I propose that the magic text inside arguments would be updated when an event gets fired. If user's don't want to use current value, they can get it from an array or variable it was saved and kept unedited.
 

MacroDroidDev

Administrator
Staff member
First, I want to say the whole concept is a good one and I will filter it into my list of things to do at some point.

Maybe it's because it's late and my brain is no longer functioning well, but I'm not fully understanding this bit:

Sometimes it could happen that the user would want to to fire the event with current values of variables as arguments, but sometimes he/she might want to use the values in state that they were while running the action.

Can you somehow express this in a way my fatigued brain can compute. Your example above didn't really help me understand what this means.
 

Endercraft

Moderator (& bug finder :D)
First, I want to say the whole concept is a good one and I will filter it into my list of things to do at some point.

Maybe it's because it's late and my brain is no longer functioning well, but I'm not fully understanding this bit:

Sometimes it could happen that the user would want to to fire the event with current values of variables as arguments, but sometimes he/she might want to use the values in state that they were while running the action.

Can you somehow express this in a way my fatigued brain can compute. Your example above didn't really help me understand what this means.
I think it means an option to decide if we want to use a new value or keep the current one.

Apparently being fatigued poses no problem to my brain, and it makes me not able to sleep well and that's very very annoying...
Anyway I'll try to sleep right now, it's 22h57 for me...
 
Last edited:

FrameXX

Well-known member
First, I want to say the whole concept is a good one and I will filter it into my list of things to do at some point.

Maybe it's because it's late and my brain is no longer functioning well, but I'm not fully understanding this bit:

Sometimes it could happen that the user would want to to fire the event with current values of variables as arguments, but sometimes he/she might want to use the values in state that they were while running the action.

Can you somehow express this in a way my fatigued brain can compute. Your example above didn't really help me understand what this means.

In some cases the user might want the event to evaluate it's arguments right before it's fired, but in some cases he might want them to evaluate when the event was setted up with the action (Show Notification action for example).
 
Top