Ringer mode timer

Post your questions and help other users.

Moderator: Martin

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Ringer mode timer

Post by MURTUMA » 26 Feb 2014 13:34

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. :/
Last edited by MURTUMA on 26 Feb 2014 21:55, edited 1 time in total.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Calculating time

Post by Martin » 26 Feb 2014 19:00

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.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Calculating time

Post by MURTUMA » 26 Feb 2014 20:33

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.

colabi
Posts: 134
Joined: 06 Jan 2013 22:33

Re: Calculating time

Post by colabi » 26 Feb 2014 20:58

operation == "cancel"

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Calculating time

Post by MURTUMA » 26 Feb 2014 21:02

Ah.. What did I say about my brains. ;). Thanks!

colabi
Posts: 134
Joined: 06 Jan 2013 22:33

Re: Calculating time

Post by colabi » 26 Feb 2014 21:38

:D

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Ringer mode timer

Post by MURTUMA » 26 Feb 2014 21:54

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.

colabi
Posts: 134
Joined: 06 Jan 2013 22:33

Re: Ringer mode timer

Post by colabi » 26 Feb 2014 23:42

I can not test your flows (4.0.4), but this is my "Silent timed" flows; maybe is useful for you:
Silent_timed.xml
(10.27 KiB) Downloaded 1341 times
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

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Ringer mode timer

Post by MURTUMA » 27 Feb 2014 08:01

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.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Ringer mode timer

Post by MURTUMA » 28 Feb 2014 17:10

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.

Post Reply