Array/dictionary's "all entries" integration

ARME

Active member
I'd like to use "all entries (array/dictionary)" for "App launched/closed" and "application running (constraint and condition)". In this way you just have to insert the variable in "package name" instead of manually selecting all the apps (which can be many). Also, I just need to add the new installed apps to the array/dictionary I want and all the macro which use this variable will be updated instantly. Please let me know if you need other explanation and please tell me if you are planning to add this feature.
maybe you could do this creating something like "group of apps" instead of using array/dictionary so that even non pro user can benefit of this feature (which actually is just to speed up the process you would have to do by adding the apps manually to trigger/condition/constraint), but of course this is up to you to decide.

Thanks in advance.
 

ARME

Active member
In array/dictionary I add some apps, but not all of them. Selecting multiple apps works but it's time consuming if you have a lot of apps to add, and they're required in multiple parts of the macro or even other macros, so using array/dictionary will senplify everything as I just have to add there the apps and adding the variable to the trigger/condition/constraint is fast.
I don't know if it's understandable
 

03b

New member
I agree with this request. It will be useful. Also with notification received/cleared/etc. I have macros that are very annoying to manage when I add/remove a new app I have to edit the included/excluded apps more than once for each step. With the different triggers and the many actions… if it was read from a variable with regex matching or array, it is much more intuitive.

So anytime we choose app names to include/exclude from that list that pops up, it should also allow to use a variable/array or other magic text that might be available that we can use to match the apps.

Trigger1 notification received from apps a,b,c
Trigger2 notification cleared from apps a,b,c

If trigger1 fired, check every minute if notification exists from app a,b,c then perform some action on those notifications like clear them.

Another trigger… constraint… action… etc… it starts to get messy. Try to add/remove an app to this macro and you have a lot of work to do with possibly introducing some error if you missed something. When it could be simple just edit one variable.

This feature will help a lot.
 
Last edited:

Quidn

Passionate Member
I'd like to use "all entries (array/dictionary)" for "App launched/closed" and "application running (constraint and condition)". In this way you just have to insert the variable in "package name" instead of manually selecting all the apps (which can be many). Also, I just need to add the new installed apps to the array/dictionary I want and all the macro which use this variable will be updated instantly. Please let me know if you need other explanation and please tell me if you are planning to add this feature.
maybe you could do this creating something like "group of apps" instead of using array/dictionary so that even non pro user can benefit of this feature (which actually is just to speed up the process you would have to do by adding the apps manually to trigger/condition/constraint), but of course this is up to you to decide.

Thanks in advance.

At least, I don't think you have to select apps manually.

Since the trigger provides application name only instead of package name, additional exception handling is required if you have to identify between apps having same name, but this is not very common problem and handling exception is not so hard.

Please let me know if I misunderstood your needs.

EDIT: There is simpler and recommended version in reply below


App_Launched.png
 

ARME

Active member
At least, I don't think you have to select apps manually.

Since the trigger provides application name only instead of package name, additional exception handling is required if you have to identify between apps having same name, but this is not very common problem and handling exception is not so hard.

The list could be single string and split into array before execution, and it can be cached if the list is so big and performance is crucial at the same time.

Please let me know if I misunderstood your needs.

View attachment 6638
Can you attach the macro ? I've never used iterate dictionary/array and I don't know how and where to add {iterator_value}
 

Quidn

Passionate Member
Can you attach the macro ? I've never used iterate dictionary/array and I don't know how and where to add {iterator_value}

Hmm... Here you are.

I don't recommend to use array or dictionary for this purpose, unless if you really needed to(e.g., to manage the list using another macro).

Using just plain text(string variable) like below may be much efficient in various aspects.


AppLaunched2.png
 

Attachments

  • AppLaunched1.macro
    5.4 KB · Views: 5
  • AppLaunched2.macro
    2 KB · Views: 4

03b

New member
@Quidn , what about when you want to add an action to clear a notification when the app is listed in the array? Or if you want to check if a notification is present? I don't think this solution works?
 

03b

New member
The main goal, to be able to perform all triggers/constraints/actions with only needing to maintain one list of apps in an array or variable. In the moment, it's not possible. Because eventually there is an action like clear notification that needs to take the app name and won't care about any variable or array. Unless I'm mistaken. Try and see.
 

Quidn

Passionate Member
@Quidn , what about when you want to add an action to clear a notification when the app is listed in the array? Or if you want to check if a notification is present? I don't think this solution works?

It seems same approach could applied to do that.

Since notification-related trigger provides app package name, so that could be more in control.

However, I think that would be a challenge to implement that to run by very reliable and handling every exceptions, whether using a list or manually select.

Does your macro which choose applications by manually run reliably? Or by acceptable reliability? Latter won't be so hard to implement.
 

03b

New member
It seems same approach could applied to do that.

Since notification-related trigger provides app package name, so that could be more in control.

However, I think that would be a challenge to implement that to run by very precise and handling every exceptions, whether using a list or manually select.

Does your macro which choose applications by manually run by precise? Or by acceptable precision? Latter won't be so hard to implement.
Thanks. But for me, a problem that I can see already is with Clear Notifications:

Action: Clear Notifications (All Applications)

Now I want to clear only apps in my array list. With your method to add a constraint to this action to run only if the app is in my array list, it does not matter. Because as soon as "Clear Notifications (All Applications)" runs, it clears all. The constraint only allowed it to run, but it does not constrain it to those applications in my array. So you see the problem?

We need to do:

Action: Clear Notifications (Array List)

Not possible?
 

Quidn

Passionate Member
Thanks. But for me, a problem that I can see already is with Clear Notifications:

Action: Clear Notifications (All Applications)

Now I want to clear only apps in my array list. With your method to add a constraint to this action to run only if the app is in my array list, it does not matter. Because as soon as "Clear Notifications (All Applications)" runs, it clears all. The constraint only allowed it to run, but it does not constrain it to those applications in my array. So you see the problem?

We need to do:

Action: Clear Notifications (Array List)

Not possible?

I checked options of Clear Notifications before writing reply, and I considered it can be possible because there is an option to clear by its content text as criteria.

I thought you are already storing the content temporarily. Because your explaining seems like every notifications are being tracked. That's why I asked its reliability.

If you currently don't store and/or don't care about notification content, you have to store them to clearing specific notification, as you may know.

Clear Notifications by app list is possible, but implementation will be a challenge, by MacroDroid alone.

Here you are: https://play.google.com/store/apps/details?id=com.balda.notificationlistener

This is a simple solution.
 
  • Like
Reactions: 03b

03b

New member
I checked options of Clear Notifications before writing reply, and I considered it can be possible because there is an option to clear by its content text as criteria.

I thought you are already storing the content temporarily. Because your explaining seems like every notifications are being tracked. That's why I asked its reliability.

If you currently don't store and/or don't care about notification content, you have to store them to clearing specific notification, as you may know.

Clear Notifications by app list is possible, but implementation will be a challenge, by MacroDroid alone.

Here you are: https://play.google.com/store/apps/details?id=com.balda.notificationlistener

This is a simple solution.

Thanks, I'll check the notification listener plugin. Hope it can be good.

I do still suggest for MacroDroid to make this possible. It would be a good feature, instead of choosing apps from the selection popup, we can store the list in a variable/array and use that. Then it's easy to use the variable/array in multiple triggers/actions/macros. When we need to add/remove any app to the list, it's just a simple edit of one variable.

You are right that I can use the notification content to clear it. But it's not so "clean" and still would be difficult to maintain the list if apps in all triggers, actions, and everything to be easily edited. Well it's not easy, but it's not impossible either. Hope the plugin can help. But still, this should be considered a good feature for MacroDroid.
 

Quidn

Passionate Member
Thanks, I'll check the notification listener plugin. Hope it can be good.

I do still suggest for MacroDroid to make this possible. It would be a good feature, instead of choosing apps from the selection popup, we can store the list in a variable/array and use that. Then it's easy to use the variable/array in multiple triggers/actions/macros. When we need to add/remove any app to the list, it's just a simple edit of one variable.

You are right that I can use the notification content to clear it. But it's not so "clean" and still would be difficult to maintain the list if apps in all triggers, actions, and everything to be easily edited. Well it's not easy, but it's not impossible either. Hope the plugin can help. But still, this should be considered a good feature for MacroDroid.

I agree to you. I always avoid to use plugins even the macro complexity increases heavily.

In my opinion, "By Condition" option would be the best, like Array.prototype.filter() of JavaScript. It can be re-used universally in all MacroDroid actions whice have "All or Selected" option.
  • Having "Conditions" option like "If clause"
  • Multiple "value"(e.g., Application Name, Package Name, ...) like {iterator_value} can be used to compare or process
  • Do or Do Not by "Conditions"

This would extend flexibility so greatedly and solve many cases by just one solution, futhermore existance of commonly used filtering method will makes easy to use MacroDroid.

Of course this is not "just one" task to @MacroDroidDev because each Action has to be modified to iterates for possible items and implementing to return values by magic text is essential.

Nevertheless I will suggest this as separated thread including example UI because this will be so useful and could be applied universally.
 
  • Like
Reactions: 03b

ARME

Active member
If you do
Trigger: app closed (all)
Action: pop up (app name)
Ad test with the calculator, does it pop up "calculator" or "system launcher"
 
Top