1. Are you ready for the Galaxy S20? Here is everything we know so far!

Problem using "If" in task

Discussion in 'Android Apps & Games' started by darkjoker213, Oct 6, 2014.

  1. darkjoker213

    darkjoker213 Lurker
    Thread Starter


    I'm trying to make a profile that runs on week days, and in this profile I'm trying to create a task that Silences my phone when I enter my classes and that returns it to the normal state when I'm on lunch break or when I'm out. My problem comes when i try to make such task i difine the task to run for example when %TIME > 08.30 and %TIME < 12.00. When I'm in the tasks menu and it's 09:00AM it shows a green bar indicating that the condition is met, even so, the task doesn't activate. What am I doing wrong?
    And before you sugest I make a profile based on time to do this, I'm trying to use a single task to adapt my hole schedule instead of flooding my profile windows with profiles of classes.

    1. Download the Forums for Android™ app!


  2. WarriusZero

    WarriusZero Guest

    Add a time based condition to your profile, even if that means having to clone your profile for numerous time periods.
    It will make everything simple and easy to maintain.
  3. I drive mine from my schedule. If I have a meeting scheduled I silence the phone (most of it) unless there is the word "Sound" in the Description of the event.

    You could do that and just have a repeating meetings.

    ... Thom
  4. darkjoker213

    darkjoker213 Lurker
    Thread Starter

    That is what i've had before, but i want to be able to activate tasks withou been dependent on the hour defined by the profile. My goal is to define a day and then be able to activate tasks based on the time of said day, and I want to do this wiithout have to flood the profiles menu with profiles that are meant to work for half an hour. I know that what I want to do must be possible otherwise the field if wouln't be there and there wouldn't be a variable time for me to use what I'm missing is how to make the task activate once the Condition is verified.

    Thanks, I've used the calendar entry to activate silence mode in my classes. Now I would only like to know how to activate the task the way I described above.
  5. I admit to being a little confused. You keep saying "activate the task".

    In the one I suggested I use a Profile to monitor the calendar to do what you are asking about.

    If the question is how to deal with time calculations in a task ... try this ...

    A1: If [ %TIME > 08.29 & %TIME < 12.01 ]
    A2: Popup [ Title: Text:%TIME Background Image: Layout:tlaPopup096 Timeout (Seconds):5 Show Over Keyguard:On ]
    A3: End If

    Notice that it is greater than and less than and not greater than or equal to and less than or equal to.

    The Profile to drive it from the Calendar is ...

    Profile: tlaMeet
    State: Calendar Entry [ Title:* Location:* Description:!Sound/sound Available:Any Calendar:Google:YOURS@gmail.com/Google:phone Calendar ]
    Enter: tlaSoundOff
    A1: Alarm Volume [ Level:0 Display:Off Sound:Off ]
    A2: DTMF Volume [ Level:0 Display:Off Sound:Off ]
    A3: In-Call Volume [ Level:7 Display:Off Sound:Off ]
    A4: Media Volume [ Level:15 Display:Off Sound:Off ]
    A5: Notification Volume [ Level:0 Display:Off Sound:Off ]
    A6: Ringer Volume [ Level:0 Display:Off Sound:Off ]
    A7: System Volume [ Level:0 Display:Off Sound:Off ]
    A8: Silent Mode [ Mode:On ]
    Exit: tlaSoundOn
    A1: Alarm Volume [ Level:7 Display:Off Sound:Off ]
    A2: DTMF Volume [ Level:0 Display:Off Sound:Off ]
    A3: In-Call Volume [ Level:7 Display:Off Sound:Off ]
    A4: Media Volume [ Level:15 Display:Off Sound:Off ]
    A5: Notification Volume [ Level:7 Display:Off Sound:Off ]
    A6: Ringer Volume [ Level:7 Display:Off Sound:Off ]
    A7: Silent Mode [ Mode:Off ]
    A8: System Volume [ Level:7 Display:Off Sound:Off

    ... Thom
  6. darkjoker213

    darkjoker213 Lurker
    Thread Starter

    Looking at what you shown me here I realize that it must be a problem with my device because if i do this

    A1: If [ %TIME > 08.29 & %TIME < 12.01 ]
    A2: Popup [ Title: Text:%TIME Background Image: Layout:tlaPopup096 Timeout (Seconds):5 Show Over Keyguard:On ]
    A3: End If

    with the actual time nothings pops out, unless i click on the play button on the bottom left corner, then the popwindow appears.
  7. That's what a Task does ... you have to manually invoke it.

    If you want it to be invoked some other way then you make it a Profile and define the task(s) to invoke when some condition(s) is met. The calendar driven Profile is an example.

    To me your objective was to automate it multiple times in the day and the calendar-driven approach does exactly that.

    What is the "trigger" to make your project start and what is the "trigger" to make it stop?

    ... Thom
  8. darkjoker213

    darkjoker213 Lurker
    Thread Starter

    So lets take this example, I make a profile that runs based on time and lets say i make the time gap from 00:01 to 23:59. If i define the task:
    A1: If [ %TIME > 16.48 & %TIME < 16.52 ]
    A2: Popup [ Title: Text:%TIME Background Image: Layout:tlaPopup096 Timeout (Seconds):5 Show Over Keyguard:On ]
    A3: End If
    if it is 16:50 the task should run itself no?
  9. The profile needs a "trigger" to make it start. All you have said is to allow it to start at any time.

    A trigger would be something like "Orientation Face Down".

    ... Thom
  10. darkjoker213

    darkjoker213 Lurker
    Thread Starter

    The trigger for the profile in this case is if the time is between 00:01 to 23:59. When it's 16.50 the profile is active. So the popup should appear at 16:50. Isn't my logic correct? Or the profile only runs the tasks the second it's activated? I though while the profile is active it would check conditions on the tasks periodically
  11. How about ...

    Profile: AAAAAA
    Time: From 00:00 every 2m Till 23:59
    Exit: Anon
    A1: If [ %TIME > 12.59 & %TIME < 23.59 ]
    A2: Popup [ Title: Text:%TIME Background Image: Layout:tlaPopup096 Timeout (Seconds):1 Show Over Keyguard:On ]
    A3: End If

    ... Thom
    darkjoker213 likes this.
  12. darkjoker213

    darkjoker213 Lurker
    Thread Starter

    Thank you very much :D Now it works as I want. Really, thank you!
  13. WarriusZero

    WarriusZero Guest

    No, in this case, at 0:01, the profile will become active, which will trigger the task.

    The task will check the time, see that 0:01 is not between 16:48 and 16:52 and end there.

    It will only run once until next time it is reactivated again, which is the day after at 0:01...

    The way you want to go, you want to be able to run the task every minute.
    Use a time based profile but untick From and To and tick Every. Then you can set it to run every minute.

    How many different time periods during the day are you going to have?

    Thom's suggestion about using the calendar is a good one, which I use to set my phone to Vibrate for each of my work meetings.

    One of the main reasons that it's a good method is that Tasker would work around events while your method will be draining the battery by running a task 1440 times a day.

    Edit: I didn't see page 2... :)
    Thom likes this.
  14. interesting ... don't enter the times.

    Tasker on my Droid Maxx allows 2 minutes minimum.

    ... Thom
    WarriusZero likes this.
  15. WarriusZero

    WarriusZero Guest

    You're correct, my mistake, the minimum is 2 minutes.


Tasker Forum


⚙No repetitive tasks for you, let your Android device handle it!⚙
Total Automation, From Settings to SMS. Here are only some
of the things you could do with Tasker. Its real power is the flexibility to combine contexts and tasks however you wish: https://tasker.joaoapps.com/exampleuses.htmlAutomations
Make your phone a true smart
phone! Why remember to change the volume every day when you leave home when your phone can do it for you? Automate stuff based on the app you're in
, the time of day
, your location
, your Wi-Fi network
, Received SMS or Calls
, the currently playing song
and many other (130+) states and events! Check out how easy it is to create an automation: https://www.youtube.com/watch?v=s6EAbLW5WSkActions
350+ actions allow you to truly customize your phone like never before! Send SMS, create notifications, change almost any system setting like Wifi Tether, Dark Mode, Always On Display, change any volume, control Do Not Disturb, open apps, file manipulation, control music playback, get your location... you get the idea. If you can think of it, Tasker can probably do it for you! Note: root is NOT (I repeat NOT) required for majority of the functions.
However, a few of the actions (like the Airplane Mode action and the Mobile Data action on some devices) require root. Regarding those few actions that do require root, this is because of Android security policies that developers cannot work around. ☑ Other Triggers
Manually trigger your actions via launcher shortcuts, quick setting tiles, widgets, long-pressing volume buttons, media buttons (like the ones on your BT headsets or headphones), Bixby button, Navigation Bar, Notificaitons and more! ☑ Join - Remote Tasker
Adding Join (https://play.google.com/store/apps/details?id=com.joaomgcd.join) to the mix will even allow you to trigger tasks from another Android device or PC! ☑ Scenes
Design your own UI and use it to display any info you want or trigger any task! ☑ App Creation
Create your own standalone apps to share or sell with the Tasker App Factory (https://play.google.com/store/apps/details?id=net.dinglisch.android.appfactory)! ☑ Developer Friendly
A lot of 3rd party developers already allow you to perform actions in their apps and listen to their events/states through Tasker! Check out a list of plugins https://tasker.joaoapps.com/pluginlist.html. You can also call most of the Web APIs from Tasker with the powerful HTTP Auth and HTTP Request actions! Check out an example https://youtu.be/yAt2D1XmgUI. ☑ 7 day trial - one time payment to unlock
Get it here: https://tasker.joaoapps.com/download.htmlUseful Links
Starter Guides: https://tasker.joaoapps.com/guides.html Pre-made projects: https://forum.joaoapps.com/index.php?resources/ Official Support Forumhttps://groups.google.com/forum/#!forum/tasker Community full of people willing to help: https://www.reddit.com/r/tasker/ It's not possible to fix problems reported via Play Store Comments so please use the "Report Issue To Developer" option in the app > Menu to do so. Note
: Tasker uses the BIND_DEVICE_ADMIN permission in order to provide the System Lock functionality

February 15, 2020
Last Updated

Share This Page