AutoInput Can AutoInput activate an action after X amount of keypress down time?

Discussion in 'AutoApps' started by crapples, Mar 19, 2018.

  1. crapples

    crapples New Member

    Joined:
    Mar 19, 2018
    Messages:
    4
    Likes Received:
    0
    I'm trying to create a task using AI, whereby it will perform a task after 1.5 seconds of the back button being long pressed.

    Problem is, I can't seem to get the task to fire unless I stop holding the back button.

    So, I'm assuming, with the task I set up, in order for the variable to set, a button up action is required? Can AI perform a task on longpress without the need of a button up action?

    Any help is appreciated. Thank You.

    This is the task I followed, which I found on Reddit.



    Code (Text):
    PROFILE:
    AutoInput Key Event > Volume Down
      Type: Both (Up and Down)

    LINK TO TASK:
    A1. If %aikeyaction ~ 0

        A2. Variable Set: %Press_Time  To: %TIMEMS

    A3. Else If %aikeyaction ~ 1

        A5.  Variable Set: %difference  To: %TIMEMS - %Press_Time   Do Maths: On

        A6. Flash "Long Press Detected!"  If  %difference > 1500

    A7  End If
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Hi there. Yes, the task should also run when you press the button down. Maybe you can add a flash action at the start of the task to verify this?
     
  3. crapples

    crapples New Member

    Joined:
    Mar 19, 2018
    Messages:
    4
    Likes Received:
    0
    Thanks for the response.

    I did test it with a flash action. However, If I keep my finger down on the backbutton, the only way the task will fire is after 4 seconds, which I assume is when the buttons time out.

    AI actions seem to be dependent on the variable being set. And it appears the variable cannot get set unless a buttonup action is received.

    I'm trying to get the task to fire without the need to lift your finger off the backbutton, similar to how Android activates a menu when longpressing a button for about 1.2 seconds.
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Can you please try with this one?
     
  5. crapples

    crapples New Member

    Joined:
    Mar 19, 2018
    Messages:
    4
    Likes Received:
    0
    Thank you. That appears to work. I changed the event to trigger off the back key, and it works.

    By default, it seems to fire after nearly 4 seconds of longpressing. I changed the count from 2 to 1, and that seems to get it to fire after about 3 seconds.

    Is there a method of editing it so it can fire after a precise amount of time?

    Thanks again.
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Unfortunately no because Tasker plugins will take an unknown amount of time to respond. Sorry!
     
  7. crapples

    crapples New Member

    Joined:
    Mar 19, 2018
    Messages:
    4
    Likes Received:
    0
    I see. Thanks again, this works.
     
: autoinput

Share This Page