Page 1 of 1

Change values

Posted: 17 Jun 2019 10:55
by Akt
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

Re: Change values

Posted: 17 Jun 2019 17:14
by Desmanto
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;

Re: Change values

Posted: 18 Jun 2019 01:25
by Akt
Thanks desmanto, it worked!!

Re: Change values

Posted: 18 Jun 2019 01:39
by Akt
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

Re: Change values

Posted: 18 Jun 2019 18:53
by Desmanto
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