Change values

Post your questions and help other users.

Moderator: Martin

Post Reply
Akt
Posts: 133
Joined: 25 May 2014 08:57

Change values

Post by Akt » 17 Jun 2019 10:55

Is there any action to change value in any action box.
Eg:-
Action : Script
a = 900

I want to change this value 900 by selecting values in input diaglogue

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

Re: Change values

Post by Desmanto » 17 Jun 2019 17:14

You mean you want to have a dialog box that present multiple predefined value and you simply choose from them?
Use Input Dialog - Single Choice Menu, put 100,200,300,600,900,1200 or any value your predefined value at the List Values.

Or you can prepared the list in script, then paired with Input Dialog - Single Choice Menu

Code: Select all

choice = newList(100, 200, 300, 600, 900, 1200 );
In the input Dialog, use {choice,listformat,comma} as the List Value (you can choose it directly by tapping the ellipsis)

The chosen value will be stored in variable {value}, use this in the following element.

Code: Select all

a = value;
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.

Akt
Posts: 133
Joined: 25 May 2014 08:57

Re: Change values

Post by Akt » 18 Jun 2019 01:25

Thanks desmanto, it worked!!

Akt
Posts: 133
Joined: 25 May 2014 08:57

Re: Change values

Post by Akt » 18 Jun 2019 01:39

I am making an snooze alarm.
It shows time only in seconds like 950 seconds.
How to convert it in minutes and second like 15 minutes and 50 seconds.

http://automagic4android.com/flow.php?i ... be984e4fda

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

Re: Change values

Post by Desmanto » 18 Jun 2019 18:53

You can use getDurationString(). This will convert the duration from miliseconds to string. Example 950000 miliseconds become "15m 50s"
If you need the "m" in "minutes, you can use replace() to replace it. Do the same also for "s" and "h" (if needed).

Or you can do your own calculation and convert it using conventional method, example value is 950000

Code: Select all

minute = value / 60000;
second = value % 60000 / 1000;
duration = minute + " minutes and " + second + " seconds"
{duration} will be 15 minutes and 50 seconds
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