IDE Communicator Tester Wierdness

I am wading into using the IDE Communicator and have already gotten some strange responses using the Tester app provided in the example projects (2025r3.1). I am sending the following script:

Var ok As Boolean = SelectProjectItem(“User”)

And the response that I get back is:

{

    "tag": "build",

    "response": {

        "scriptError": [

            {

                "type": "scriptCompilerError",

                "line": 2,

                "number": 11,

                "message": "This item does not exist",

                "location": {

                    "character": 67,

                    "endcharacter": 73,

                    "column": 38,

                    "endcolumn": 44,

                    "line": 2,

                    "endline": 2

                }

            }

        ]

    }

}

There is a compiler error on line 2, but there is no line 2. And there definitely aren’t any characters at position 67 to 73.

Does anyone have any idea what’s going on?

Yeah so… IIRC there is context information that’s prepended to your script.

Look at The start and end column…. Column 38 to 44, I believe that’s “user” in the code you posted. Make sure your script doesn’t actually contain curly quotes.

That first line is 29 characters and could easily be

Const XojoVersion = 2025.031

IIRC there is context information that’s prepended to your script.

Is that done inside the script engine or something like that? I don’t see anything being added to the script before it leaves the Tester app.

And if so, how can I reliably interpret any error location that is returned? Do I always just add one to whatever line number is returned and then use the column values?

Make sure your script doesn’t actually contain curly quotes.

That’s the TextArea automatically converting to smart quotes when I type :angry: . I added some code to fix that and it’s working.

Thanks!

I would do that, yes.

Remember, the underlying engine is still just xojoscript and all it sees is a single script + the context (in this case, supplied by the IDE itself). IIRC the reason XojoVersion is declared as a constant is for compatibility, speed and so comparisons don’t break because it’s a “double”.