Global variable-comparing with tasker

General discussions about Automagic and automation in general

Moderator: Martin

coconutxyz
Posts: 38
Joined: 16 Sep 2019 12:51

Global variable-comparing with tasker

Post by coconutxyz » 07 Dec 2019 01:57

So i stumbled upon this thread on reddit

https://www.reddit.com/r/tasker/comment ... or_states/

and really liking how clean it is to set all the variables in this way and be able to call it in different profile/tasks. Is there any alternative way to do it in automagic?

P/s: as a total noob i personally thought automagic kinda relies a lot on using script/expression like how tasker is relying on plugin but at least tasker/plugin present things in individual field format with list of choices? please correct me if i am wrong.

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

Re: Global variable-comparing with tasker

Post by Desmanto » 07 Dec 2019 03:50

Same, simply use script with glovar, with the approriate trigger
Flow 1 (Entry task)
Trigger : Wifi connected, choose your SSID
Script : global_work = 1

Flow 2 (Exit Task)
Trigger : Wifi Disconnected, choose your SSID
Script : global_work = 0;

Use the glovar trigger in another flow (or any other) to detect changes in the global_work
Trigger : Global Variable - global_work
Expression : global_work == 1;
True, set ringer volume to 1 (or any work related set of actions)
False, set ringer volume to 3 (or the exit set of actions)


But you don't have to do so in Automagic if you only need the OR logic. Tasker and Automagic is completely different when dealing with profiles/triggers. viewtopic.php?f=5&t=7217
Automagic using OR logic in all of the triggers, while tasker use AND logic (and limited to 3 per profiles). Both can use the opposite logic. Automagic can use AND logic by using condition or subsequence flow. While Tasker can use OR logic by creating multiple profiles with the same task.

If OR logic is what you want, It is much easier to just use the trigger wifi connected directly. It is only when you need AND logic that you may use this glovar assignment method just like tasker when it needs OR logic.

The advantage of Automagic's glovar is it can use glovar map. This way, you can store pratically unlimited key in just a single glovar. Rather than tasker which you have to spam the glovar list will all the glovar needed. I store multiple state of my network home automation device/config/state in single glovar map. Another set of flows use another glovar map, which keeps all of them tidy.


I wish tasker will implement scripting by its own. The user interface also should be upgraded. It is so painful the last time I want to replicate a simple flow that I can easily create in Automagic. Script might seems scary at first. But you will find it is way much more flexible than using individual actions to process variable. When you deal with variable parsing, formatting or any kind of processing, you will be troubled by how many actions you need for a replacement of several lines of script in Automagic.

Many tasker users have to revert to javascript or other scripting when dealing with these; while automagic already has a very powerful scripting that you only need to learn how to use it. But of course, most first time users will be confused. Just ask here when you get stuck at the scripting, after you have search the forum and can't get the similar thread to your problem.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

coconutxyz
Posts: 38
Joined: 16 Sep 2019 12:51

Re: Global variable-comparing with tasker

Post by coconutxyz » 07 Dec 2019 04:54

Thanks Desmanto, your posts are always helpful. I wouldn't even consider Automagic without user like you and Martin on board. Not to say other users aren't helpful, but Tasker's community and availability of tutorial are really tempting for a beginner like me. Wish automagic could grow bigger.

Regarding your sample flow, would it be cleaner if i am using condition to change the glovar --> if connected then true = 1 and false = 0? I find conditions in automagic is much easier to read and implement than Tasker and unfortunately i haven't seen a use case for OR logic, everything still runs on AND logic so far.

Though scripts are powerful, i still hope that there will be some breakdown of actions like "wait" in tasker without using sleep(), where at least new users could choose directly from the interface. i especially like how Tasker segregates project, profiles and task compared to Automagic's folder method, where i couldn't quickly change an action for all usage without going into one of the flow. i am more of a visual person so flowchart works really well for me except the other menu.

Lastly could you explain more/link me to what glovap map is? i think it might be something i need to keep things tidy. Also are those INIT Variable settings relevant in this case?

Btw i know Malay language and i've seen you mention providing help in one Indonesia forum. Are you Indon by any chance?

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

Re: Global variable-comparing with tasker

Post by Desmanto » 07 Dec 2019 18:25

coconutxyz wrote:
07 Dec 2019 04:54
1. Thanks Desmanto, your posts are always helpful. I wouldn't even consider Automagic without user like you and Martin on board. Not to say other users aren't helpful, but Tasker's community and availability of tutorial are really tempting for a beginner like me. Wish automagic could grow bigger.

2. Regarding your sample flow, would it be cleaner if i am using condition to change the glovar --> if connected then true = 1 and false = 0? I find conditions in automagic is much easier to read and implement than Tasker and unfortunately i haven't seen a use case for OR logic, everything still runs on AND logic so far.

3. Though scripts are powerful, i still hope that there will be some breakdown of actions like "wait" in tasker without using sleep(), where at least new users could choose directly from the interface.

4. i especially like how Tasker segregates project, profiles and task compared to Automagic's folder method, where i couldn't quickly change an action for all usage without going into one of the flow. i am more of a visual person so flowchart works really well for me except the other menu.

5. Lastly could you explain more/link me to what glovap map is? i think it might be something i need to keep things tidy.

6. Also are those INIT Variable settings relevant in this case?

7. Btw i know Malay language and i've seen you mention providing help in one Indonesia forum. Are you Indon by any chance?
I numbered the post for easier tracking response :)

1. I am glad that I can help. I also thought the same when the first time I use Automagic. Although I never play part in tasker community other than in kaskus local forum, which is much more narrow (tasker thread); but I can't deny that there are more tutorial/documentation on how to do something in tasker. This is why I also try to promote Automagic (or at least mention it when it is approriate) when posting in other forum. The more user we have in Automagic, the more tutorial/how to we can have. (hopefully)

2. Yes, you can use the condition in that way too. For every wifi connected/disconnected, check the connection to the SSID and store the state in glovar. You can check the glovar later using AND logic.

3. We have a few script functions that are broken down into action. Sleep has the standalone action version, which can be implemented as delayer/synchronizer. Creating new map of key-value can be done using action Map Value (although I never use it anymore now) There maybe other, but I am more to the scripting part. So far, I have 500+ script, 750+ expression and 100+ Control UI.

4. I actually like all things in single basket; triggers then its action. I combine several similar logic flow into single flow, instead of spreading it over several flows. If you prefer otherwise, you can do the same as tasker do also in Automagic. The project is the flow grouping. If you need to separate profile (trigger) and the task (actions); simply create the actions in separate "task" flows. So you will replicate all the task in taskers into multiple flows without trigger, and those flows must be enabled. Then in another "profile" flows, create the appropriate triggers with single action, execute flow, choose the "task" flows; it can be multiple flows. This way, all the "task" flows act as a set of actions, where if you change it, it will affect all triggers which call it. Some of the users here also do the same, so they can reuse a single flow into multiple triggers case.

I have several flows like this, except I combine it into multiple usages and with other triggers too. Example, my latest full fledge flow, Yeelight Control; to turn on/off, change color, color flow of my yeelight bulb. The main control flow has multiple triggers and can be called from other flow with multiple parameter. I can use manual shortcut, to select the light color, it is a simple input dialog with choices. Or I can use widget, either at home screen or my smartwatch to turn on/off the lamp. Or it can be triggered by my daily alarm, where I put flashing white red color to wake me up as my alarm ring. Or the other triggere from my speech flow, where I can shout "Illumination", to turn on the light. Basically I also use the same concept as profile/task in tasker, except I mixed it so much that the line get blurred :D

5. Glovar map or Global variable map type, is just the same map type variable, but the global version. When you create new variable in global variable section, example global_new, you can tap the "String" and change to "Map". Press add value and add the key. Put the name you want, example "wifistate" and put Number 1. You can see now global_new contains key "wifistate" with value 1. You can add as many key as you want here, and the result of the glovar use is only 1. To access the wifistate later, you must use the key as in global_new["wifistate"]. Example usages are i don't need to store my router username password as to two separate glovar : global_F660_username and global_F660_password. I can store it in global_iot["F660 username"] and global_iot["F660 password"]; and it only use single space global_iot. I store several other router info here too. Tasker doesn't have this luxury, it doesn't support list/map in the glovar (don't know with the latest version though). Imagine that I have to use hundreds of glovars in tasker to store all my states, where I can use only tens in Automagic. (or 1 only, if you are brave enough to confuse yourself :D)

6. The init variable system setting can be used too to get the direct value of the system state, including wifi, bluetooth, gps and other. It is easier to assign the value directly to the glovar to store it. But I usually prefer to use built-in action if there are. Only for some setting those don't have the condition to check it, I will check the value directly here (example : to check bluetooth priority). Using built-in action is more user-friendly than using init variable system setting. But both method can be used.

7. Yes, I am Indonesian. I am active in local forum here, especially for my phone thread (Redmi Note 5), android troubleshooting, and some other android thread including Automagic. Tasker thread is practically dead there, Automagic thread still has rare visitor from time to time.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

coconutxyz
Posts: 38
Joined: 16 Sep 2019 12:51

Re: Global variable-comparing with tasker

Post by coconutxyz » 08 Dec 2019 09:08

Damn the glovap map is indeed very useful for me.

also using flows without trigger to store all related task is a really creative way to replicate how tasker works

i think i have a lot of works to do now lol.

Thanks a lot for the guidance so far!

One more thing, hopefully we could get something like Tasker logcat soon, the "which finger" action is particularly interesting
also is there something like tasker's state? something like this https://www.reddit.com/r/tasker/comment ... in_tasker/

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

Re: Global variable-comparing with tasker

Post by Desmanto » 08 Dec 2019 17:10

The permission to do logcat/dumpsys without root, has been added to the AM 1.38 EAP since May this year. viewtopic.php?f=7&t=7986&start=30#p24812

Unfortunately, it seems Martin still doesn't have the release schedule yet. It will be many feature addition in this 1.38, once it is released to the playstore. There seems to be some functions broken in android 10, and Martin have to ensure fixing them first, rather than breaking many users flow.

I personally have root and have use the logcat method to detect my fingerprint. Trigger fingerprint doesn't work at my phone, so I have to use the logcat to detect the fingerprint event to trigger secret camera capture. I only enabled it on demand and set up a disabler using display off trigger.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

coconutxyz
Posts: 38
Joined: 16 Sep 2019 12:51

Re: Global variable-comparing with tasker

Post by coconutxyz » 10 Dec 2019 12:52

good to hear that we have the logcat function, at least we have features on par with tasker

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

Re: Global variable-comparing with tasker

Post by Desmanto » 10 Dec 2019 18:19

Besides app creation and the scene (widget equivalent), in my opinion Automagic is already more powerful than tasker. Tasker now started to implement some of its plugin function built-in. The one I remember such as input dialog now available as built-in action in tasker; while I have been using this heavily since I switched to Automagic. It is to 3rd most used action in all my flows, 170 instances.

And one the thing I love the most is I can install just only Automagic, and it can cover maybe more than 80% of my need. While in tasker you still have to install several plugins just to achieve a single goal.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

coconutxyz
Posts: 38
Joined: 16 Sep 2019 12:51

Re: Global variable-comparing with tasker

Post by coconutxyz » 12 Dec 2019 12:42

Yea one thing I dislike is after using Tasker autoinput and auto tools is almost necessary to do anything I need.

What is input dialog if you don't mind me asking

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

Re: Global variable-comparing with tasker

Post by Desmanto » 12 Dec 2019 18:42

Action Input Dialog, the one we use to choose from several choices. If you use tasker, previously you have to use Autotools to do that. While we can do that natively in Automagic, at least since I switched in the mid of 2017.

Tasker just got updated to the new version and several android sites put an article for it. Approximately half of the new features already here in Automagic. I am jealous that when Automagic got new version, I can't find any news for it anywhere (outside of this forum/playstore description). I have tried in the past to notify xda about this, and they don't seems to favor any other automation app outside of tasker. I will definitely try again when the next AM 1.38 released.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply