disabled flows list

Post your questions and help other users.

Moderator: Martin

User avatar
Rafi4
Posts: 208
Joined: 01 Dec 2017 05:23

disabled flows list

Post by Rafi4 » 02 Aug 2019 07:54

hi
list=newList(getFlowNames());
with this script I am getting all flows list. I want to get only disabled flows list. Is there any solution? because I want to enable those flows with shortcut.

thanks from record4
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
Desmanto
Posts: 1981
Joined: 21 Jul 2017 17:50

Re: disabled flows list

Post by Desmanto » 02 Aug 2019 17:51

It is very dangerous to enable a lot of flows at once, unless you already know the exact usage of all of them. Currently there is no direct way to get the state of all flows. You can loop check using condition to the list of flows you get from getFlowNames(). But that is very slow.

I create my own method to init the flows.xml, using regex to find all the flow names including all of their attributes. Using the same method, we can retrieve the flows state and save it to certain glovar. We can also only get the list of enabled flows or disabled flows. The flow and script is quite long, seems to be too hassle for your usage case.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

User avatar
Rafi4
Posts: 208
Joined: 01 Dec 2017 05:23

Re: disabled flows list

Post by Rafi4 » 19 Aug 2019 00:34

Hi Desmanto
Trigger =notification on Statusbar displayed
Action= script
a=getFlowNames()
Condition = if notification contains any flow names execute that flow.
How can use it in this way? Because I want to use some time trigger flows using global variable date and time using shortcut.

From record4
Samsung Galaxy j2 non rooted.
Android 5.1.1

canadaDry
Posts: 24
Joined: 09 Feb 2018 18:38

Re: disabled flows list

Post by canadaDry » 19 Aug 2019 00:54

Hi, (not Desmanto) but thought I'd weigh in...

How about just create a small file (or even hard code the list in the script) that contained a table of:

Code: Select all

notification trigger word, flow name
notification trigger word, flow name
notification trigger word, flow name...
Since you must have written the script to deal with the notification you would just add the trigger word and flow name to the list.
Then you can just see if there's a match in the list and call the assoc. flow.

Perhaps I missed something in your purpose though.

User avatar
Rafi4
Posts: 208
Joined: 01 Dec 2017 05:23

Re: disabled flows list

Post by Rafi4 » 19 Aug 2019 05:36

Hi Canadadry
Where can I found the word "weigh" in automagic premium?
From record4
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
Desmanto
Posts: 1981
Joined: 21 Jul 2017 17:50

Re: disabled flows list

Post by Desmanto » 19 Aug 2019 06:03

@Rafi4 : I am also no very clear about your main purpose. If you need to execute flow based on the notification text, why don't simply put the {notification_text} in the execute flow?

Of course, if you need to crosscheck first if the flow exists, you can use the getFlowNames() and only continue to execute flow if the flow exists.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

User avatar
Rafi4
Posts: 208
Joined: 01 Dec 2017 05:23

Re: disabled flows list

Post by Rafi4 » 19 Aug 2019 13:37

Hi Desmanto
Flow name is for example "Test on"
If notification text contains "Test on" go to true Execute the flow "Test on" if doesn't contains go to false

From record4
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
Desmanto
Posts: 1981
Joined: 21 Jul 2017 17:50

Re: disabled flows list

Post by Desmanto » 19 Aug 2019 17:19

Does the notification contains "Test on" as in "Test on can be executed", or just "Test on" without any extra wording?

If just "Test on", then it is much easier, simply use

Code: Select all

containsElement(getFlowNames(), notification_text)
True, execute flow {notification_text}, false do nothing.

But if the text only contains and can have longer wording, you should loop the flownames

Code: Select all

for(i in getFlowNames()
{
  if(contains(notification_text, i))
    return true;
}
return false;
Same, true execute flows {i}, false do nothing.

But be careful for the exact wording. Because if you have flow's name as "on can", this will execute that flow too. So you have to make sure the word doesn't contain any other flow than the one you need. It is better to limit the text to a certain pattern, so you never mis trigger any wrong flow. You can still use regex or just a simple startsWith() or endsWith() to get the flow name correctly.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

User avatar
Rafi4
Posts: 208
Joined: 01 Dec 2017 05:23

Re: disabled flows list

Post by Rafi4 » 25 Aug 2019 13:58

Hi Desmanto
Working fine. But False going to execute last index of the flow.


For example
Flows list

Awake
Bubble
Cartoons
Test

if the notification_text doesn't contains any flow name it was executing the last flow "Test". How can I avoid this?
thanks from record4
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
Desmanto
Posts: 1981
Joined: 21 Jul 2017 17:50

Re: disabled flows list

Post by Desmanto » 25 Aug 2019 18:01

Where do you put my previous script, in a script or an expression? It should be expression. If you have put it into expression, only connect the true branch to the execute flow. Leave the false branch not connected. So when it loop until finished and found nothing, it will return false and the flow stopped there.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

Post Reply