• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Set a Variable using another Variable

Mastoris

Lurker
Mar 27, 2015
2
1
I'm trying to make a Context and Project counter using the Todo.txt format. You can read about the format here if you like.

With Todo.txt, you sort your tasks with @Contexts and +Projects like this:

Call +John in the @Morning for help with +TaskerCounter @Phone

So I am now using Tasker to count and sort how many contexts I have. Here's what I've got so far:

Set Variable %item > @Morning:3
Variable Split %item SPLITTER = :
FLASH %item1 = @Morning
FLASH %item2 = 3

Set Variable %%item1 > %item2

WHAT I WANT:FLASH %@Morning = 2

So that I can bring up how many morning related tasks I need to accomplish by calling the context name.

WHAT HAPPENS:

Tasker stops (red icon next to action) on

Set Variable %%item1 > %item2

Can anyone tell me whats going on and how I can accomplish what I'm trying to do?
 
Actually, it is valid, just not in this way of using it. I found the answer to my own question. Tasker DOES allow you to nest references like this, as read here:

"it's possible to assign variables whose name is not known beforehand:

Read File, variablename.txt, To Var, %varname
Variable Set, %%varname, red
This will set the variable whose name is stored in the file variablename.txt to red.

You can nest references as deeply as you like (e.g. %%%%var) but mental stress and bugs are sure to follow."



But unfortunately, it looks as if Tasker will not set a Variable if the VALUE of the variable is a SYMBOL such as @ or +.

Basically

FLASH %item1 = @Morning
FLASH %item2 = 3Set Variable %%item1 > %item2 Will FAIL
But


FLASH %item1 = Contextmorningcount
FLASH %item2 = 3

Set Variable %%item1 > %item2 will work.
 
  • Like
Reactions: codesplice
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones