for example,I need to determine 'Go TABUNDOCLOSE' can currently be executed.
if can,
cmd.AddLine('Go TABUNDOCLOSE');
else
cmd.AddLine('Go C:\ NEWTAB');
cmd.Run
I'm not sure if there is a way to do it from JScript, but it can be done from the Evaluator:
Go {=IsEnabled("Go TABUNDOCLOSE") ? "TABUNDOCLOSE" : """C:\"" NEWTAB"=}
If the aim is to have a button which opens a new tab (one way or the other), one problem is that Go TABUNDOCLOSE doesn't AFAIK have a way to activate the tab it re-opens. So it will open, but may be in the background and need clicking to activate it.
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).