[error] Error in runEval code: Unexpected token [Issue #345]

Hello, I’ve got this error:
[error] Error in runEval code: Unexpected token =
which is triggered by this code:
[info] Executing: | storeEval | var = “${useful_info}” | useful_info |

Value contained in variable USEFUL_INFO is “1.Aparthotel Adagio La Defense Le Parc.\n2.-Russian speaking driver.”

I found that the error is related to the “\n” tag contained inside the string.

Best regards.

I confirmed the issue. We will be fixing this asap.

Update: It turns out that this is not a bug in Kantu, but an issue the way storeEval and Javascript work:

This macro breaks because there is a line break in eval code.

var1 =  "1.Aparthotel Adagio La Defense Le Parc.
2.-Russian speaking driver."

This is what’s going to be called eval , while javascript requires an trailing \ at this end of each line for a multiline string. It’s hard for Kantu to tell when it should add that \ , given that we don’t parse javascript used in storeEval (the Chrome/FX Javascript interpreter parses it) .

Solution: Use ` instead of " because the backtick ` supports multiline strings natively.

So inside the storeEval command use var1 = `${useful_info}`;
instead of var1 = "${useful_info}";

This modified macro works ok:

  "Name": "test",
  "CreationDate": "2018-12-16",
  "Commands": [
      "Command": "store",
      "Target": "1.Aparthotel Adagio La Defense Le Parc.\\n2.-Russian speaking driver.",
      "Value": "useful_info"
      "Command": "storeEval",
      "Target": "var1 =  `${useful_info}`",
      "Value": "aaa"