How to determine whether a command can currently be executed in a jscript?

In 13.23.5 we added this so scripts can do the same test:

  • Added Command.TestCommandState() script method. Similar to IsSet but with a less confusing interface. First argument is the full command line to test. Second optional argument is flags; only one defined currently is "e" which tests if the command is enabled rather than checked (the default).