For simple JavaScript functions it is often sufficient to output a small message for testing and debugging with alert():

function test(s)
{
  alert(s);
}

You call the JavaScript function in GuiXT with:

CallJS test "Hello"

and receive the following small popup on your screen:

 

 

For more complex functions in JavaScript it is practical to work with a debugger. The easiest way to call the debugger is to use the "Attach to Process..." function of Visual Studio:

Here select the process "saplogon.exe" and "Script Code" in the selection box.
You now have two possibilities to execute your JavaScript function in the debugger. The easiest way is to use the function

Debug -> Break All

Then execute the JavaScript function via the GuiXT script. The debugger becomes active at the first executable line of the function:

Another possibility is to stop the JavaScript function at a certain position with the "debugger" statement:

 

You can now proceed step by step, display variables and use the other functions of the debugger, e.g. set dynamic breakpoints or display variables.


Note 1:
At the end of your JavaScript file, GuiXT automatically inserts an object "guixt" at loading time. This object can be used to communicate with GuiXT from JavaScript, as well as some functions that are needed to call JavaScript.


Note 2:
If InternetExplorer is not installed on your PC (usually from Windows 11), please allow script debugging directly in the WIndows Registry:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main   Disable Script Debugger="no"