1
Solved

JS writeFile append parameter ignored

The "append" parameter for the JS function "writeFile()" described in the wiki here seems to be ignored and is always set to false.

To reproduce this issue:

  1. Create a task with the Javascriptlet
    writeFile("log.txt", "some random text", 1);​
  2. Run the task and look for "log.txt". Check that "some random text" appears on line 1.
  3. Go back to the task and change "some random text" into "text to append".
  4. Run the task again.
  5. Check log.txt and see that "some random text" has disappeared and only "text to append" is visible.

Can anyone reproduce?

I am running Tasker 5.7.2 on Android 8.0.0.

2 replies

FH

Thanks, that solves the problem!

In this case I would have appreciated to have a small chapter in the wiki on how Tasker handles data types.

I was (mistakenly) under the impression that a "boolean" in Tasker doesn't actually exist and that 1 and 0 are the preferred values for true and false. At some points within the app, I tried to compare a value to an empty string, but I couldn't: If I left the field empty, I couldn't leave the action ("Error: please enter a value for the condition right-hand-side"), but if I wrote "", the variable would be compared to the literal string "".

I simply assumed there was a risk that the js adapter to Tasker would at some point convert true (the boolean) to "true" (the string), so I wanted to be sure.

Did I miss some documentation of data types in Tasker?

This is just standard javascript though, so most Tasker rules don't apply :) It's just normal javascript rules. Glad it worked!

Can you try setting the last parameter to true instead of 1?

Topic is closed for comments