MSHTML Methods: queryCommandIndeterm

Scripting Syntax

bIndeterminate = object.queryCommandIndeterm (sCommand);


The queryCommandIndeterm method applies to the document and TextRange objects and the controlRange collection.


The required sCommand argument names a command to execute. There are many supported commands.

Return Value

The method returns true if the named command is supported and enabled and is in the indeterminate state. Otherwise, it returns false.


The queryCommandIndeterm method provides scriptable access to the object’s IOleCommandTarget functionality, specifically to call the QueryStatus method and test for a particular combination of flags.

The case-insensitive command name given as sCommand translates to a numeric command ID in the MSHTML command group represented programmatically by CGID_MSHTML. Even within this command group, only a small subset of the commands that are supported through the IOleCommandTarget interface are supported for scripting.

The queryCommandIndeterm method fails, in the sense of causing a runtime script error, if the given command name is not supported for scripting. It also fails, again with a runtime script error, if the call to QueryStatus fails.

Given a successful call to QueryStatus, the queryCommandIndeterm method returns true or false according to whether QueryStatus produces the following combination (in which the second part represents the indeterminate state):

Behavior within the call to QueryStatus varies with the command and is anyway left for the different topic of MSHTML’s IOleCommandTarget functionality.

There is a demonstration here. To see it, please enable scripting and then refresh this page.

function Test_document_queryCommandIndeterm ()
    var cmd = prompt ('Enter the name of an MSHTML command to query for the "indeterminate" state:', "");
    if (cmd == null) return;

    var result = document.queryCommandIndeterm (cmd);
    alert ('queryCommandIndeterm ("' + cmd + '") for the document returned ' + result);