Step 1: Have tasker read todo.txt
We will first create a profile in tasker, lets name it todo. Next add time context (I have mine set to from 10.00 to 20.00 repeat every 30minutes) this would depend on how frequent you want tasker to "read" todo.txt for any todos.
Next add a task lets name it read. Now todo.txt has a file in your sdcard that stores all created and completed todos located at /sdcard/data/com.todotxt.todotxttouch/todo.txt
so we will now add new task>file>read line> location:/sdcard/data/com.todotxt.todotxttouch/todo.txt ; line leave it empty; Var set to:%TODO, click done.
Now for this function, if line is left empty, tasker will read the line after what was being 'read' by tasker in the previous run. If the end of the file is read %TODO will be set to EOF, we don't want that. Also, a completed todo shows up as 'x ddmmyyyy (name of todo)' we don't want that 'read' either.
Step 2: Have next line or first line read if %TODO is EOF/starts with x
Now add another task under read >tasker>stop select IF %TODO!~EOF/x* this would allow tasker to stop 'reading' todo.txt if %TODO~an outstanding todo.
Add another task >tasker>goto action select 1 , this would allow tasker to read the next line or read the first line again if EOF is reached or a completed todo line is 'read' until a %TODO output containing an outstanding todo is reached.
Step 3: preventing loop actions in the absence of oustanding todos
In the absence of any outstanding todos, the file will contain either x ... or EOF, so the task will run in an infinite loop if there is no further condition applied.
We will be using a counter to stop any infinite loops
First add a task>variables> variable clear set to clear %COUNTER, place this task at the top above the task that reads /sdcard/data/com.todotxt.todotxttouch/todo.txt . (position 1)
Next add another task > variables>subtract value set to %COUNTER value=2 if %TODO ~x* place it below the read /sdcard/data/com.todotxt.todotxttouch/todo.txt task (position 3)
Add another task>variables>subtract value> set to %COUNTER value=1 if %TODO~EOF. Place it at position 4 before the stop task.
Add another task>variables>add value>set to %COUNTER value=2 Do not select any if variables. Place it at position 6 after the stop task.
Finally alter the Goto task at position 7 to run action 2 instead of 1 and select IF %COUNTER<2.
The previous step basically prevents the task to continue in an infinite loop by limiting the number of loops to go through the todo.txt file twice.
Now the task list should look like:
1. clear %COUNTER
2. read /sdcard/data/com.todotxt.todotxttouch/todo.txt to %TODO
3. subtract value= 2 to %COUNTER if %TODO~x*
4. subtract value= 1 to %COUNTER if %TODO~EOF
5. stop if %TODO!~EOF/x*
6. Add value= 2 to %COUNTER
7. goto action 2 if %COUNTER<2
Step 4 Create Notification
Last but not least we need a notification to get this working. Create another profile name it reminder (or as you please) set context to when %TODO is set.
For the tasks we will first add a stop function if %TODO~EOF/x*, this prevents your notification from popping up when a completed todo is read or EOF is reached.
Next add in the type of notification under add task>alert>notify sound select to display %TODO and play a custom sound. You may add in notify vibrate if you wish.
And apply your changes!
**you may wish to test your tasks out before applying**
And thats it!
Have fun todo-ing!