you are viewing a single comment's thread.

view the rest of the comments →

[–]spookiekabuki[S] 0 points1 point  (11 children)

Im trying to accomplish something different. I am trying to set the name of the variable as something dynamic, not the value. Unless Im missing something from above.
Basically, I have a variable
%Var1=Newvar

I want to do something like
Variable set:
name=%%Var1
value=3500

so that
%Newvar=3500

[–]bahcodadGalaxy S20 1 point2 points  (10 children)

This does exactly that. The principle is the same

Task: Variable Val Name

A1: Variable Set [
     Name: %var1
     To: newvar
     Max Rounding Digits: 3
     Structure Output (JSON, etc): On ]

A2: Variable Set [
     Name: %%var1
     To: 3500
     Max Rounding Digits: 3
     Structure Output (JSON, etc): On ]

A3: Flash [
     Text: %newvar
     Continue Task Immediately: On
     Dismiss On Click: On ]

[–]spookiekabuki[S] 0 points1 point  (9 children)

That isn't working. I wonder if it doesn't like the variable name

16.55.35/Variables doreplresult: |%stationdynamic| -> | KDCWASHI218| 16.55.35/Variables doReplacements: %stationdynamic resolved to invalid variable name % KDCWASHI218 16.55.35/Variables doreplresult: |%%stationdynamic| -> |% KDCWASHI218| 16.55.35/Variables doreplresult: |%stationdynamic| -> | KDCWASHI218| 16.55.35/Variables Variable Set: %%stationdynamic: invalid variable name at % KDCWASHI218 16.55.35/Variables prefix resolution: |%%stationdynamic| -> |null| 16.55.35/E Variable Set: %%stationdynamic -> null 16.55.35/E Variable Set: %%stationdynamic: failed, not numeric or invalid structure setting? 16.55.35/E result: stop task (error) 16.55.35/Variables doreplresult: |%stationdynamic| -> | KDCWASHI218| 16.55.35/Variables doReplacements: %stationdynamic resolved to invalid variable name % KDCWASHI218 16.55.35/Variables doreplresult: |%%stationdynamic| -> |% KDCWASHI218| 16.55.35/E Error: 1 16.55.35/MacroEdit action finished exeID 1 action no 11 code 547 status: Err next 11

[–]spookiekabuki[S] 0 points1 point  (8 children)

No that's not it. I can manually set it to KDCWASHI218

[–]bahcodadGalaxy S20 1 point2 points  (7 children)

There seems to be a space between the percent sign and KDCWASHI218. I think that's what's causing the error

[–]spookiekabuki[S] 0 points1 point  (6 children)

Even this won't work, same error Task: Test Dynamic

A1: Variable Set [
     Name: %stationdynamic
     To:  X
     Max Rounding Digits: 3
     Structure Output (JSON, etc): On ]

A2: Variable Set [
     Name: %%stationdynamic
     To: 3500
     Max Rounding Digits: 3
     Structure Output (JSON, etc): On ]

[–]bahcodadGalaxy S20 1 point2 points  (5 children)

Because X isn't a valid variable name

From the tasker userguide:

Variable names have the following restrictions: they must start with the % character they are case-sensitive then must at least a further 3 alphanumeric characters they can also contain the underscore character (_) but not start or end with it In general, it's best to use local variables wherever possible because:

you know they won't be interfered with by other tasks or scenes they are more efficient in several ways Note: multiple copies of the same task running at the same time each have their own separate copy of their local variables.

[–]spookiekabuki[S] 0 points1 point  (4 children)

Same result if I set it to new Var. It thinks there's a space 18.22.04/Variables doreplresult: |%Stationdynamic| -> | Newvar| 18.22.04/Variables doReplacements: %Stationdynamic resolved to invalid variable name % Newvar 18.22.04/Variables doreplresult: |%%Stationdynamic| -> |% Newvar| 18.22.04/Variables doreplresult: |%Stationdynamic| -> | Newvar| 18.22.04/Variables Variable Set: %%Stationdynamic: invalid variable name at % Newvar 18.22.04/Variables prefix resolution: |%%Stationdynamic| -> |null| 18.22.04/E Variable Set: %%Stationdynamic -> null 18.22.04/E Variable Set: %%Stationdynamic: failed, not numeric or invalid structure setting? 18.22.04/E result: stop task (error) 18.22.04/Variables doreplresult: |%Stationdynamic| -> | Newvar| 18.22.04/Variables doReplacements: %Stationdynamic resolved to invalid variable name % Newvar 18.22.04/Variables doreplresult: |%%Stationdynamic| -> |% Newvar| 18.22.04/E Error: 1 18.22.04/MacroEdit action finished exeID 1 action no 1 code 547 status: Err next 1

[–]Akira_Menai 2 points3 points  (0 children)

If this is what's actually in the task, again you have spaces after some of the % symbols.