Global variable and widget
Moderator: Martin
Global variable and widget
Lol ive tried and tried, even imported flows but can never figure out how to add global variables properly. I have no idea what im doing even after reading tutorials
Re: Global variable and widget
If you use a variable name in one flow where the variable name starts with "global_", then that variable (and it's contents) becomes available for use in any other flow
Re: Global variable and widget
Sorry, yeah i get the idea. I just cant seem to have any of them function with the associated values in widgets nor can i figure out a great number of correct values to do a lot of actions. But thank you
Re: Global variable and widget
Glovar is just the same local variable as the ones you used, except it stays after the flow execution. Widget can also store value in the text field, so essentially makes them behave just like glovar, but with limited capability (it can't store map/list or event pure location type variable).
The widget text can be set to certain glovar, by using {global_text} in the text field. But I personally avoid this method. SInce we have to store our value first in the glovar, and increasing the glovar usage. The more glovar you have, the slower your overall flow execution, so avoid storing everything there.
I personally prefer to use setWidgetElementProperty(), to change the widget text directly from the script. This doesn't require glovar, and the value persist after execution (behaves just like glovar). Makes it perfect to store some text too. You can find the setWdiget function from the script/expression > function > find setWidget and you can choose to change any widget property you want.
The widget text can be set to certain glovar, by using {global_text} in the text field. But I personally avoid this method. SInce we have to store our value first in the glovar, and increasing the glovar usage. The more glovar you have, the slower your overall flow execution, so avoid storing everything there.
I personally prefer to use setWidgetElementProperty(), to change the widget text directly from the script. This doesn't require glovar, and the value persist after execution (behaves just like glovar). Makes it perfect to store some text too. You can find the setWdiget function from the script/expression > function > find setWidget and you can choose to change any widget property you want.
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.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Global variable and widget
Thanks hunny... i sorted out my mistakes and got a grip on it now