> Go ahead :) Though I can't promise anything as my free timeslots are pretty
> random :)
Thank you - here you go!
I have a data set in the file dsdwado.txt that contains an active
application output such as the following:
net.dinglisch.android.taskerm
com.android.mms
/data/data/com.android.smith/bin/smithd
de.devmil.minimaltext
com.htc.android.htcime:provider
com.levelup.beautifulwidgets
com.google.android.apps.maps:NetworkLocationService
com.htc.bgp
com.facebook.katana
com.android.vending
com.google.android.apps.plus
com.google.android.apps.uploader
com.htc.android.mail
com.sdgtl.watch.flyer
com.htc.bg
bbc.iplayer.android
com.noshufou.android.su
I want Tasker to check each line using the 'test package name' action
and convert if from com.facebook.katana to Facebook for example so
it's readable for the user.
The task is set up as follows:
A1: Test [ Type:File Name Data:DSD/Lib/dsdwado.txt Store Result In:
%FNAME Continue Task After Error:On ]
A2: If [ %FNAME ! Set ]
A3: Goto [ Type:Action Number Number:17 Label: ]
A4: End If
A5: Variable Add [ Name:%LINE Value:1 Wrap Around:0 ]
A6: Read Line [ File:DSD/Lib/dsdwado.txt Line:%LINE To Var:%PNAME
Continue Task After Error:On ]
A7: If [ %PNAME ~ EOF ]
A8: Variable Clear [ Name:%PNAM*/%LINE Pattern Matching:On ]
A9: Goto [ Type:Action Number Number:17 Label: ]
A10: End If
A11: Test [ Type:Package Name Data:%PNAME Store Result In:%PNAMEL
Continue Task After Error:On ]
A12: Write File [ File:DSD/Lib/dsdwador.txt Text:%PNAMEL Append:Off ]
If [ %LINE = 1 ]
A13: If [ %PNAMEL Is Set ]
A14: Write File [ File:DSD/Lib/dsdwador.txt Text:%PNAMEL Append:On ]
If [ %LINE > 1 ]
A15: End If
A16: Goto [ Type:Action Number Number:5 Label: ]
A17: Perform Task [ Name:DSDWLAA Stop:On Priority:9 %par1: %par2:]
If the above makes sense, the %LINE increases by 1 each time until it
returns EOF, then it goes on to perform another task. If it matches
the package name it writes it to the text file dsdwador.txt, then goes
back to the top of the loop to check the next %LINE. If it doesn't
match the package name (%PNAMEL isn't set), it doesn't write the entry
and returns to the top of the loop.
In dsdwador.txt I end up with an output of:
Facebook
Tasker
Beautiful Widgets
Etc
Which is exactly what I want, howevever it takes quite a while to run
which I assume is down to the process of: read a line, write a line,
read a line, write a line and so on and so forth...
So, I think there must be a better way to do this using an array? Get
the data into an array, get Tasker to check each segment of the array,
exporting it to another array if it's matched and then writing the
array to a file in one action perhaps...?
But, I can't get my head around how do it....
If you (or anyone else), have any ideas of how to, please do hit me
with them! Thanks in advance!
>Out of curiousity, what is your project about? Is this the Android deep
> sleep / running process thing you were working on?
Yup, up to V14 now - I'm pretty sure it's the closest you can get to a
fully functional application built with Tasker... V14 is due out soon
and has automatic updates, error logging, dynamic shell scripts etc
and it most importantly detects and names rouge wakelocks between
display on/off cycles in real time. There's not an actual Android app
that does that.. yet. I'm pretty proud of it and will keep improving
it over time as a bit of a hobby...