“Variable Set” event can pass the new value (%evtprm2) but not the previous value?

51 views
Skip to first unread message

Zoltán Bíró

unread,
May 19, 2023, 7:53:09 AM5/19/23
to Tasker
As events appear in multitask environment it's more than welcomed that the new value of the variable (which actually triggered the event) can be accessed as a local variable %evtprm2 instead of reading the original global variable (which could have been changed again since triggering the event).

But it would be also welcomed to have a local variable for the previous value of the variable in question: there might be situations where its's important the value the variable has been triggered from. E.g., not the same thing whether a track stopped event triggers when a track is still playing or when it's already paused. 

May I suggest this change for upcoming Tasker versions? 
Of course, the current workaround is not that difficult, as previous values always can be saved safely as a global variable, but this global variable should be initialized etc., so it's still a bit uncomfortable.  

Say, %evtprm4: previous value of the variable which triggered the event.    

João Dias

unread,
May 23, 2023, 5:35:11 AM5/23/23
to tas...@googlegroups.com
Sorry, I won't be adding that but you can create a task variable (in the task > Settings > Create new task variable) and call it %previous. Then you can set that variable as you wish and it's local to just that task :) Hope this helps!

Thank you for your contact.

   Join: connect multiple devices (send pushes, remote SMS, notifications) on Android, Windows, Mac, Linux
   Tasker: customize/automate anything on your phone!
   AutoApps: add advanced functionality to Tasker via plugins

     

João Dias


Zoltán Bíró

unread,
Jun 6, 2023, 6:18:41 AM6/6/23
to Tasker
Sorry for the delay, I've found your mail in spam folder.

So, your solution is neither perfect nor equivalent to what I proposed in my first mail. Namely, there is a problem with the FIRST iteration. When Tasker said the variable was changed, he obviously knew the previous value, as the new value is different from it. But my local%previous is not even initialized at this pont. Unless I guess the initial value (not always possible, e.g. a media track can be changed even before Tasker initialises itself after a restart) the first iteration will always be unsure. 
That is, I still consider a serious and welcomed addition.

best regards,
Zoltán 

João Dias

unread,
Jun 6, 2023, 6:31:54 AM6/6/23
to tas...@googlegroups.com
But Tasker won't also know what the previous one is in the first iteration, so it would be the exact same situation :)

Zoltán Bíró

unread,
Jun 6, 2023, 7:26:56 AM6/6/23
to Tasker
But Tasker won't also know what the previous one is in the first iteration, so it would be the exact same situation :)

If so, how Tasker knows that the new value is different, if the old value is not known? 

João Dias

unread,
Jun 6, 2023, 9:01:59 AM6/6/23
to tas...@googlegroups.com
It doesn't know that it's different, it just knows that it was set.

Zoltán Bíró

unread,
Jun 6, 2023, 9:36:36 AM6/6/23
to Tasker
Normally, if you set the same value twice to a certain variable, the Variable set event will fire just once. So where is the difference? Why you souldn't know which value had the variable before?

João Dias

unread,
Jun 7, 2023, 10:29:43 AM6/7/23
to tas...@googlegroups.com
But I don't know in the first iteration, just like you :)
Reply all
Reply to author
Forward
0 new messages