Adding a random dinner suggestion to my Tasker morning message
My sleep mode Tasker setup has perhaps gotten a tiny bit out of hand, but in a good way. It started off with dimming the backlight at night, and then it grew to the…thing it is now. The latest addition to it is an idea I like a lot, and one that I didn’t come up with myself. Instead it came courtesy of a friend of mine, who is as little into mobile tech as can possibly be, and has only ever dealt with Tasker though my constant babbling about it. He suggested that I should make an app that gives you a dinner suggestion each day, picked from a list you control yourself. Long story short, my dinner today is what my phone suggested I eat this morning.
Setting up this system is actually pretty simple. First off, you need a text file with all your dinner suggestions in it, separated by a character that isn’t likely to be part of the name of a dish. In my case, the contents of the text file looks something like this:
dish 1|dish 2|dish 3|dish 4|dish 5
This file needs to be located on the device, but you can set it up to sync with your computer using Dropsync, allowing you to add and remove dishes from other devices.
Tasker task
1. Read File:
File: dinner.txt
To Var: %dinnertext
2. Variable Split:
Name: %dinnertext
Splitter: |
3. Variable Set:
Name: %dinnerrandom
To: %dinnertext(#)
4. Variable Randomize:
Name: %dinnerno
Min: 1
Max: %dinnerrandom
5. Variable Set:
Name: %Dinnersuggestion
To: %dinnertext(%dinnerno)
What it does
Every time the task is run, it writes one of the dishes (picked randomly) from the text file to the global variable %Dinnersuggestion. This variable can then be used for whatever you want, be it a notification, a Say, a widget – anything. In my case, I added it to my wake up Say in the form “If you have no other plans, may I suggest %Dinnersuggestion for dinner?”
The result of my setup is what you see in the video at the beginning. Do note that the video shows my entire sleep mode system being run, which checks weather, todo list, sleep duration, turns on/off my PC monitors, and a lot more.
Of course, many recipe apps offer suggestion features. The advantage of this is that you control the list it picks from, as well as how that information gets presented to you.