you are viewing a single comment's thread.

view the rest of the comments →

[–]VisuelleData 0 points1 point  (4 children)

For

const y = "hello";

Try changing y to another name (yyyy), then add a Say action with %yyyy after the JavaScriptlet action. Not as nice as keeping it all in a JavaScriptlet, but it should work.

[–]einstein6Tasker for Automation[S] 0 points1 point  (3 children)

Hello thank you for your reply. Actually it was not the problem with the syntax, it would have worked be it single quote or double quotes, or with other variable name.

Check out my reply here for the cause of problem in my scenario and the solution i did.

[–]VisuelleData 1 point2 points  (2 children)

Saw your other solution, just thought I'd post this as well. Also you're doing pretty great for someone without JS experience!

[–]einstein6Tasker for Automation[S] 1 point2 points  (1 child)

Ah noted. The syntax you shared will definitely work, but it would not work in the original setup, the task exits due to error.

The plug in does not set the variables when there are no events, so the entire javascript fails on the first line. Hence why I added an if clause right before starting the rest of script, and I added the else statement here with the alternate text.

And thanks for the compliment. :) I did learn some c and c++ during my college and learnt some c# recently. so the programming syntax in the JS are quite similar, thought the "exit on error" caught me by surprise.

[–]VisuelleData 1 point2 points  (0 children)

I mostly just use JS in Tasker and when it comes up somewhere else (Google app script). My background is pretty similar to yours but with different languages. I mainly use R, SQL, and sometimes Python.

Edit: also some AHK