Noob variable question


Last Updated:

  1. Methos1979

    Methos1979 Well-Known Member

    I've had Tasker for a couple months but have only done the most basic programming. I just rooted my phone and installed the Secure Settings app so I could right profiles and tasks that could reboot my phone automatically.

    So I have a Task that just reboot's the phone but I would like to put in some sort of variable query before the reboot command that prompts the user before the reboot occurs with the option to cancel the reboot by pressing a button. If no button is pressed within like 5 or 10 seconds then the reboot occurs.

    Any direction on to achieve this would be very helpful!

    Advertisement
  2. electricpete

    electricpete Well-Known Member

    Here's my profile to do similar.
    My logic, if no button pressed, reboot does not occur
    Profile: RebootProfile (9)
    Time: 10:50
    Enter: Anon (12)
    A1: Notify Sound [ Title:Getting Ready To Reboot Text: Icon:<icon> Number:0 Sound File: Priority:3 ]
    <Should not be needed, but is needed. Menu doesn't execute default when times out>
    A2: Variable Set [ Name:%RebootProceed To:N Do Maths:Off Append:Off ]
    A3: Menu [ Title:Reboot? Background Image: Layout:IconAndTextMenu Timeout (Seconds):25 Show Over Keyguard:On ]
    A4: If [ %RebootProceed ~ Y ]
    <Set off due to leak in droidwall>
    A5: WiFi [ Set:Off ]
    A6: Reboot [ Type:Normal ]
    A7: End If
  3. Methos1979

    Methos1979 Well-Known Member

    Thanks for the example. A couple questions: Do I type it in exactly like that? Do I have to exit Beginner Mode to type in this type of thing? Are the comments inside the < > brackets just information for me and not required in the program?

    The Time: 10:50 - does that mean this occurs at 10:50 daily for you? You logic is opposite mine in that I want the reboot to cancel if I press the button, correct?

    Thanks for the info - it's starting to make a little sense.
  4. electricpete

    electricpete Well-Known Member

    No, this is what Tasker produces when you export a profile.
    A1 through A7 are labels added in the process to identify the 7 lines or actions in my task.
    The commands are inserted within Tasker action menu. That brings up a dialogue box. Some action dialogue boxes have arguments / options. The arguments/options are listed in square brackets in this exported version. Most of those arguments are the default, things I didn&#8217;t even change in the dialogue box.

    I don&#8217;t think it&#8217;s required but certainly you&#8217;ll want to exit Beginniner mode eventually to get full capabilities.
    You don&#8217;t type it in, you select the actions from menus.

    Yes. These actually things I have typed into the &#8220;label&#8221; field for certain commands, used here similar to comments in other programming language.
    Each label/comment appears prior to the action that it describes.

    Yes

    Yes. I used to have it the opposite way (the way you described). But I changed it based on a bad experience: I was on the phone in a business conference call at 10:50 and didn&#8217;t notice the reboot prompt and therefore didn't respond. My *&*^% phone rebooted in the middle of the phone conversation, kicking me off the phone call... not a good thing. That&#8217;s why this logic makes more sense to me to only reboot if explicit permission is given.

    The options in the &#8220;menu&#8221; command gives ability to identify which menu action will occur by default if user doesn&#8217;t select any. I had found it didn&#8217;t always work correctly (at least in previous versions of Tasker), so I took charge of the default behavior myself with this structure (the menu doesn&#8217;t directly execute the desired action... it just sets a variable RebootProceed that is subsequently checked in the if/then statement).

    I think maybe having problems with the basics of creating profile and creating actions? I'm using Tasker version 1.3.3u2m which has a different user interface than later versions, so it wouldn't make sense for me to try to describe step-by-step interaction with the UI unless you are using the same version.

Share This Page