Script help

Post your questions and help other users.

Moderator: Martin

Post Reply
Jptooch
Posts: 7
Joined: 01 Nov 2019 00:09

Script help

Post by Jptooch » 11 Jan 2020 00:10

I currently have a flow that helps me at work. When I trigger the flow, it will simply put the "trigger time" in the notification area on my phone. The script I use to get the trigger time is {triggertime,dateformat,hh:mm} . Here is where I need help. What script string would I use to take the trigger time and add 30 minutes to it? For example, if I execute the flow at 10:00, 10:30 is the time that would display.

Thank you in advance.

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

Re: Script help

Post by Desmanto » 11 Jan 2020 01:25

use addMinutes(). While you can add the time directly to the triggertime, it is a better practice to modify it in other variable first.

Code: Select all

tt = addMinutes(triggertime, 30);
then use {tt,dateformat,hh:mm} in your notification.
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.

Jptooch
Posts: 7
Joined: 01 Nov 2019 00:09

Re: Script help

Post by Jptooch » 11 Jan 2020 02:14

Thank you

Would I add the string tt = addMinutes(triggertime, 30); to a global variable? I'm not sure where to add it?

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

Re: Script help

Post by Desmanto » 11 Jan 2020 03:03

No need to do so. All variable are default to local variable, only exist during flow execution and destroyed after flow stop. You only need global variable if you want to use this variable in other flow, which I don't think you need it here. If you really need it later, you can simply add global_ tag to the variable name.

Code: Select all

global_tt = addMinutes(triggertime, 30);
Then use {global_tt,dateformat,hh:mm} in your other flow.
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