Tasker: How to detect "Nothing is detected"

109 views
Skip to first unread message

Thomas Li

unread,
Aug 17, 2013, 12:17:35 AM8/17/13
to tas...@googlegroups.com
I want to detect "screen is not touched" when an app is launched.

Currently, I am able to use the getevent to get the the touch detected.

I save the getevent output to %Touched
Then, I detect it with either "ISSET" or %TRUN ~ *,%Touched,*

but I don't know how to detect "nothing is touch"

What I want to to do is if an app launch and nothing is touch, turn off the screen in 2 secs, otherwise, do nothing.

any help is appreciated

SunKol

unread,
Aug 17, 2013, 1:55:46 AM8/17/13
to tas...@googlegroups.com
Can you check whether Context EVENT->Variable Change (invert) helping ??

TomL

unread,
Aug 17, 2013, 9:00:29 AM8/17/13
to tas...@googlegroups.com
You're right, you cannot detect 'nothing detected'. Same way you cannot prove 'Jim never lies'; you cannot prove a negative. What you can do is change the statement into a positive statement, and try to prove that. Like I can prove 'Jim lied today about eating the pie'.

So, in your case, I would break the problem down like this.


Profile Detected It Happened
Context event: it happened
Action: set var %DetectedTime = %TIMES


Profile Checking If Nothing has Happened For 2 seconds
Context event: your event here
Actions:
Wait 2 seconds
Set var %SecondsSince = %TIMES - %DetectedTime
If %SecondsSince > 2*60 then 'nothing detected in 2 seconds'

Thomas Li

unread,
Aug 19, 2013, 6:25:43 PM8/19/13
to tas...@googlegroups.com
Thanks for all the input.
I, kinda, make it work with some trick.

What I do is to
1. run the getevent command, and **Check the  "Continue Task After Error" checkbox**, and then set the timeout to 10sec.
   - I assume the getevent will return error if nothing is detected/touched

2. Then I use the condition statement to check
   - if %Output is NOT set
      - do something
   - endif

It seems working fine now. :)
Reply all
Reply to author
Forward
0 new messages