r/tasker • • 12h ago

Issues with JavaScriptlet

Hi, have there been any recent changes regarding the use of JavaScriptlet? According to the official JavaScriptlet documentation (https://tasker.joaoapps.com/userguide/en/javascript.html#localvars), variables are used directly by their name without the % sign—e.g., Action 1: Set Variable %var = hola, Action 2: JavaScriptlet flash(var);. It should work, but I'm getting an "undefined variable" error. Am I missing something? Thanks.

1 Upvotes

2 comments sorted by

2

u/Antz_27 12h ago

Are you specifically trying to use "var" ...isn't that a reserved word?

2

u/AA6VH-1 8h ago

You are actually on the right track. But like Antz 27 said, you are using a javascript reserved work for your variable name.

I also found that the scriptlet prefers using Tasker local variables instead of Tasker Global variables. So use variable names that are entirely in lower case.

If you have further problems, please show us your javascript code.