To clarify:
My idea is to trigger on a File Modified context
...or on any other File event type.
I've thought about monitoring the pid/oom of Tasker when I open it, then triggering when the value indicates that it is in the background...
The reason this is not my first choice is to avoid my runlogs getting cluttered by a looping task that will always run when Tasker is open... making debugging a nightmare.
> I've worked around this by creating a shortcut to a task that toggles the profiles Off, then launches Tasker.
That means you will always launch tasker from your home screen, correct? And that is where you will end up when exiting tasker.
So I think you could turn on a profile that monitors %WIN when you. Start tasker and when it matches your home screen turn on the other 2 profiles and turn off the %WIN profile. Even if you you end up starting another app from the notify bar I am sure you will hit your home screen fairly soon after..
Just one thought..
Well, that is an approach I had not considered. It won't be that easy, but i might be able to work with that concept to fit.
That means you will always launch tasker from your home screen, correct?
Sometimes, but not usually. I do have the shortcut on my homescreen, but i mostly launch tasker (from that shortcut) via my 'Pie' which overlays Nova launcher and any foreground app. So I don't always return to homescreen.
I'll see if I can run with %WIN though, to make it work. :)
> ...or something like that...but it appears that the window name for tasker does not appear in %WIN.
Perhaps others could post there findings but this is where it gets strange on my device. If I have tasker enabled in accessibility settings then I do not get a window value for tasker.
However if I "Do Not" have tasker enabled but have another app enabled in the accessibility settings then I do get a window value for tasker using %WIN with tasker. You might need to read that again but I assure you it is correct..
In other words as long as any app is enabled in the accessibility settings then tasker does not have to be enabled. For %WIN to work "And" I get a window value for tasker.
@jeremy, you might try making a app factory app to monitor %WIN for 'Tasker'. I know your device has some issues with tasker apps and accessibility but it might be worth a shot..
but this is where it gets strange on my device.
Well, I can confirm that %WIN does not load if Accessibility is enabled for Tasker, and that when I disable accessibility for Tasker and leave it enabled for another app, I can confirm that %WIN does contain a value....but does yours say "Stop Tasker?"
Weird. See screenie.
@jeremy, you might try making a app factory app to monitor %WIN for 'Tasker'. I know your device has some issues with tasker apps and accessibility but it might be worth a shot..
That's a good idea to make an external app. I think I'll end up monitoring the oom value with a kid app that prints a line to a file when Tasker closes. Then a File Modified context to trigger a task that toggles the profile status.
That should be fairly accurate/responsive and will keep the runlog from all that clutter.
> Well, I can confirm that %WIN does not load if Accessibility is enabled for Tasker, and that when I disable accessibility for Tasker and leave it enabled for another app, I can confirm that %WIN does contain a value....but does yours say "Stop Tasker?"
No, mine just says 'Tasker'. Do you get the 'Stop Tasker' when you first open tasker?
Perhaps it is the version, I am on Version: 4.6u3m
>
> Weird. See screenie.
Yeah, i just updated to u3 and I still get 'Stop Tasker?' and it is the same, even after closing and relaunching tasker.
From the FAQ:
Why isn't Tasker shown in the Application Context list ?
Because it's easy to get into trouble firing tasks in Tasker. For example, if a profile is setup with a Tasker Application Context and a task with Load App Calculator, it will not be possible to enter Tasker anymore.
http://tasker.dinglisch.net/userguide/en/faqs/faq-why.html
With that said... This task works perfectly, exported as an app and in conjunction with a File Modified context. Response from tasker closing, to kid app detecting and writing file, to profile activated is about one second. :)
Detect Tasker (355)
Run Both Together
A1: Variable Set [ Name:%newline To:
Do Maths:Off Append:Off ]
A2: Variable Set [ Name:%space To: Do Maths:Off Append:Off ]
A3: Run Shell [ Command:ps Timeout (Seconds):0 Use Root:Off Store Output In:%apps Store Errors In: Store Result In: ]
A4: Write File [ File:appz Text:%apps Append:Off Add Newline:On ]
A5: [X] Stop [ With Error:Off Task: ]
A6: Variable Split [ Name:%apps Splitter:net.dinglisch.android.taskerm Delete Base:Off ]
A7: Variable Split [ Name:%apps1 Splitter:%newline Delete Base:Off ]
A8: Variable Set [ Name:%last To:%apps1(#) Do Maths:Off Append:Off ]
A9: Variable Set [ Name:%taskerpidline To:%apps1(%last) Do Maths:Off Append:Off ]
A10: Variable Split [ Name:%taskerpidline Splitter:%space Delete Base:Off ]
A11: Variable Set [ Name:%taskerpid To:%taskerpidline4 Do Maths:Off Append:Off ]
A12: Run Shell [ Command:cat /proc/%taskerpid/oom_adj Timeout (Seconds):0 Use Root:Off Store Output In:%oom Store Errors In: Store Result In:%Aresult ]
A13: [X] Flash [ Text:%oom Long:Off ]
A14: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A15: Goto [ Type:Action Number Number:1 Label: ] If [ %oom < 2 ]
A16: Write File [ File:DetectTasker/shutdownlog.txt Text:%DATE %TIME Append:On Add Newline:On ]
...and that weird value contained in %win? It's coming from the title of a popup alert that I get when I toggle the accessibility service off for tasker, in android settings.