Home » Company » Blog » Community » Inspect and debug scripts with var_dump

New in v16.10: Inspect and debug scripts with var_dump

Andy Boyd, IDM
Marketing Manager

A quick tip for all of you who are using scripting in UltraEdit v16.10...

If you've written a script in UltraEdit, you've no doubt had to do some debugging/testing of the values in your variables. In the past, you've had to do this by writting a few lines - sending output to the output window, a new file, alert prompt, etc. While this was not relatively difficult, it likely required a few lines of code...

As of v16.10, you can now debug/inspect your variable data using a single function call - var_dump().

Below are a few examples of how you can use the var_dump function.

Example 1:

//EXAMPLE 1:
var str1 = "hello world";
var_dump(str1);

Output:

Running script: C:\scripts\test_script.js
=================================================
var_dump Output :
string(11) "hello world"

Script succeeded.

Example 2:

//EXAMPLE 2:
var myArray = new Array("one", "two", "three");
var_dump(myArray);

Output:

Running script: C:\scripts\test_script.js
=================================================
var_dump Output :
array(3) {
  [0]    => string(3) "one"
  [1]    => string(3) "two"
  [2]    => string(5) "three"
}

Script succeeded.

Example 3:

In addition to "dumping" variables, you can also dump the contents of an object:

//EXAMPLE 3:
var_dump(UltraEdit.activeDocument);

Back to Top

Comment on this post

Required fields are marked with *.


Back to Top