Page 1 of 1

JS Evaluate - Load JS script from File - encoding issue?

Posted: Mon Jul 20, 2020 3:49 pm
by juanlu
Hi Oleg,

We are trying to use the functionality to load a js file in a JS Evaluate action. So far we haven't been successful.

We are already using the JS Evaluate action today, either using a simple js statement directly in the field "Expression to evaluate" or adding a script with "Use Internal Script". But now we are trying to use "Load JS script from File" and it doesn't seem to work.

RoboTask finds the file and can access it: if we leave the file empty or the variable in the "Expression to evaluate" is not present in the script, RoboTask shows the corresponding error message. But it seems to be an encoding issue (we have tried UTF8, UTF8-BOM, UTF16, ANSII windows-1252, ANSII ISO-8859-1); even a file containing just containing var dummy="helloworld"; can't be read correctly. The generic error that we get is Error: Line number 1 (1) Invalid symbol

What can we do to read a simple js file?

Kind regards, Juanlu.

Re: JS Evaluate - Load JS script from File - encoding issue?

Posted: Tue Jul 21, 2020 9:28 am
by juanlu
Furthermore, I duplicated the demo task "JS Evaluate demo" (https://robotask.com/tasks/Demo/%5BDEMO ... 20demo.tsk). I changed it by copying the JS code in the "Use Internal Script" to an external js file. Then I changed from "Use Internal Script" to "Load JS script From File".

Same issue:
"Line number 1 (7), Invalid character"
"Erro is in additional functions"

Re: JS Evaluate - Load JS script from File - encoding issue?

Posted: Tue Jul 21, 2020 10:16 am
by Oleg
This is a bug, sorry.
We'll fix it and release the patch ASAP

Re: JS Evaluate - Load JS script from File - encoding issue?

Posted: Tue Jul 21, 2020 11:18 am
by juanlu
Oleg, thanks for the prompt reply and for the feedback.