Page 1 of 2
Ringer mode timer
Posted: 26 Feb 2014 13:34
by MURTUMA
I'm using input dialog to ask me a time. What ever time i choose, i want to add that to the triggertime. I have some hard time finding right calculations for that "value" variable so the outcome would be right.
Yeah, i know it's easy but somehow my brains isn't working properly. :/
Re: Calculating time
Posted: 26 Feb 2014 19:00
by Martin
Input Dialog with type Time uses the current day for the date and the time configured in the dialog so you could subtract the current day to get the time in milliseconds:
action Script: diff = value - getDate(triggertime, 0, 0, 0);
The getDate-function returns the current date but hours, minutes and seconds set to 0. Subtracting this date from value produces the difference in milliseconds. When you set the time to 00:01 in the time dialog, you would get a difference of 60000ms.
Re: Calculating time
Posted: 26 Feb 2014 20:33
by MURTUMA
Thanks! I didn't see the date being included.
Related to this, when I press cancel and use expression: operation == cancel to detect that, it always follows the false path. Various sleep actions between input dialog and expression didn't help. Debug dialog shows everything to be correct, so I don't see where's the problem.
Re: Calculating time
Posted: 26 Feb 2014 20:58
by colabi
operation == "cancel"
Re: Calculating time
Posted: 26 Feb 2014 21:02
by MURTUMA
Ah.. What did I say about my brains.

. Thanks!
Re: Calculating time
Posted: 26 Feb 2014 21:38
by colabi
Ringer mode timer
Posted: 26 Feb 2014 21:54
by MURTUMA
http://automagic4android.com/flow.php?i ... ece3c0d68f
So, here's what I've made up so far. Everything works perfectly except the exe flow's global variable trigger doesn't fire up. Both variable name and value are correct, at least if I'm not blind too.
Edit: global variable date/time doesn't work either.
PS. I changed topic as this expanded to include the whole flow.
Re: Ringer mode timer
Posted: 26 Feb 2014 23:42
by colabi
I can not test your flows (4.0.4), but this is my "Silent timed" flows; maybe is useful for you:
Flow "
Silent (timed)" fire when the phone get in vibrate mode (sound = 0), and display a notification in statusbar for 30s. After 30s, if you not select notification, phone remain silent and notification is removed.
Flow "
Silent (timed) - notification" fire if notification is selected, and you can input time (how long the phone will remain silent)
Flow "
Silent (timed) - restore" fire when the time is up, and the phone ringer mode is restored to normal.
Flow "
Silent (timed) - disable" fire if you manualy restore ringer mode to normal
Re: Ringer mode timer
Posted: 27 Feb 2014 08:01
by MURTUMA
Colabi: You could just delete the first expression, empty the trigger and execute it manually from input dialog onwards. That way you could check the problematic part of the flow.
Re: Ringer mode timer
Posted: 28 Feb 2014 17:10
by MURTUMA
On your flow everything works. Could you check what's wrong with my flow? In my previous post I told how you can do that but here's again: execute the flow manually and bypass the first expression. The problem is somewhere in the timer variables.
EDIT: Nevermind. I double checked that only after posting this comment and I found the problem immediately. Seems like good night sleep can fix some brain damage.