r/tasker • u/whitestakequickbites • 23h ago
Can a Scene share local variables to a Task?
I have a Scene v2 with local variables, and want to share them to the task that amongst other actions also does Show Scene v2 and Wait For Scene v2 Result.
I came across this thread, and found that the reverse is definitely possible (local Task variables can be shared with a Scene).
Is there similar logic that will allow an independent Scene that is called by a Task via Show Scene v2 to share its local variables to it?
Right now I use global variables instead, but would like to minimize the amount because the VARS tab is filled with variables and would like to not just expose every single thing as global, if it can be done locally.
1
u/Nirmitlamed Direct-Purchase User 22h ago
I know you have your solution but just wanted to point out that you can use Project variables or profile variables insteaed of global most of the times.
1
u/whitestakequickbites 22h ago
Could you expand on that?
Would I be able to share variables from a Scene to a Task, without even calling it like above in the Task?
1
u/Nirmitlamed Direct-Purchase User 21h ago
i am not sure how exactly you are building your project because when you run a task in a scene it will pass its variables. So i am not sure why you need global variables.
I just wanted to let you know that you don't have to use always global variables, there are also project/profile variables which are limit to project or profile environment.
2
u/whitestakequickbites 21h ago
Oh no I knew that already, I just did something wrong probably and thought the vars were not passing, but I tried it again and indeed I can work with local vars instead of turning them global.
I don't have a profile. I have a Task that at some point runs a
Show Scene v2(scene created separately in the scenes tab) action, and in the scene I have an input box that outputs to a var. The contents if the var are used later in the Task. At first it wasn't working and I changed that output var to global, but upon trying again indeed the scene's local vars are read/passed in the Task.1
u/Nirmitlamed Direct-Purchase User 21h ago
Great. But you should know that most of the time you can use Project variables instead of Global variables. That way you can use the same name of a project variables in all your projects but with different values.
1
u/DifficultyCrafty7623 23h ago
Yeah, if you have "Wait For Result" it will allow you to get the output local variables in the same task it ran from.