Geoff Chappell - Software Analyst
Some MSHTML classes receive commands through an IOleCommandTarget interface. A few of these classes expose some of their supported commands to scripting. These are the classes that represent the document and TextRange objects and the controlRange collection. Scripted access is obtained through the methods
The IOleCommandTarget interface provides for command groups represented by a GUID, known as a CGID. Each command has its own numerical identifier, known as the command ID, with respect to its group. For the exposure to scripting, the CGID is necessarily CGID_MSHTML and each command is identified by a case-insensitive name, not by a number.
The table below lists all the command names that MSHTML.DLL at least recognises, in the sense of answering affirmatively to queryCommandSupported, even if only to handle trivially. It will surprise nobody that several of these supported command names are absent from Microsoft’s list of Command Identifiers in the HTML and DHTML Reference. These are highlighted in the list below. Almost all, but certainly not all, are unsupported. Not highlighted are the several, such as “Open”, that Microsoft says are “currently not supported” but which have significant implementations.
Each command name is shown with its corresponding numerical command ID. These all have symbolic names defined in MSHTMCID.H from the Platform SDK. Since the numerical ID and its symbolic name are not exposed to scripting, they might be of interest only to programmers, but to know the correspondence may help with scripting since some of the otherwise undocumented commands, such as “RespectVisibilityInDesign”, do get documented by Microsoft under these symbolic names in the separate reference for MSHTML Editing.
2D-Position | IDM_2D_POSITION (0x095A) |
AbsolutePosition | IDM_ABSOLUTE_POSITION (0x095D) |
AutoDetect | IDM_AUTODETECT (0x0919) |
BackColor | IDM_BACKCOLOR (0x0033) |
BackgroundImageCache | IDM_BACKGROUNDIMAGECACHE (0x097E) |
BlockDirLTR | IDM_BLOCKDIRLTR (0x0930) |
BlockDirRTL | IDM_BLOCKDIRRTL (0x0931) |
Bold | IDM_BOLD (0x0034) |
BrowseMode | IDM_BROWSEMODE (0x084E) |
ClearAuthenticationCache | IDM_CLEARAUTHENTICATIONCACHE (0x3A9B) |
Copy | IDM_COPY (0x000F) |
CreateBookmark | IDM_BOOKMARK (0x084B) |
CreateLink | IDM_HYPERLINK (0x084C) |
Cut | IDM_CUT (0x0010) |
Delete | IDM_DELETE (0x0011) |
DirLTR | IDM_DIRLTR (0x092E) |
DirRTL | IDM_DIRRTL (0x092F) |
EditMode | IDM_EDITMODE (0x084F) |
FontName | IDM_FONTNAME (0x0012) |
FontSize | IDM_FONTSIZE (0x0013) |
ForeColor | IDM_FORECOLOR (0x0037) |
FormatBlock | IDM_BLOCKFMT (0x08BA) |
GetBlockFormats | IDM_GETBLOCKFMTS (0x08B9) |
Indent | IDM_INDENT (0x088A) |
InlineDirLTR | IDM_INLINEDIRLTR (0x0932) |
InlineDirRTL | IDM_INLINEDIRRTL (0x0933) |
InsertButton | IDM_BUTTON (0x0877) |
InsertFieldset | IDM_INSFIELDSET (0x0847) |
InsertHorizontalRule | IDM_HORIZONTALLINE (0x0866) |
InsertIFrame | IDM_IFRAME (0x086E) |
InsertImage | IDM_IMAGE (0x0878) |
InsertInputButton | IDM_INSINPUTBUTTON (0x0843) |
InsertInputCheckbox | IDM_CHECKBOX (0x0873) |
InsertInputFileUpload | IDM_INSINPUTUPLOAD (0x0846) |
InsertInputHidden | IDM_INSINPUTHIDDEN (0x0908) |
InsertInputImage | IDM_INSINPUTIMAGE (0x0842) |
InsertInputPassword | IDM_INSINPUTPASSWORD (0x0909) |
InsertInputRadio | IDM_RADIOBUTTON (0x0874) |
InsertInputReset | IDM_INSINPUTRESET (0x0844) |
InsertInputSubmit | IDM_INSINPUTSUBMIT (0x0845) |
InsertInputText | IDM_TEXTBOX (0x0871) |
InsertMarquee | IDM_MARQUEE (0x0886) |
InsertOrderedList | IDM_ORDERLIST (0x0888) |
InsertParagraph | IDM_PARAGRAPH (0x0884) |
InsertSelectDropdown | IDM_DROPDOWNBOX (0x0875) |
InsertSelectListbox | IDM_LISTBOX (0x0876) |
InsertTextArea | IDM_TEXTAREA (0x0872) |
InsertUnorderedList | IDM_UNORDERLIST (0x0889) |
Italic | IDM_ITALIC (0x0038) |
JustifyCenter | IDM_JUSTIFYCENTER (0x0039) |
JustifyFull | IDM_JUSTIFYFULL (0x0032) |
JustifyLeft | IDM_JUSTIFYLEFT (0x003B) |
JustifyNone | IDM_JUSTIFYNONE (0x005E) |
JustifyRight | IDM_JUSTIFYRIGHT (0x003C) |
KeepSelection | IDM_KEEPSELECTION (0x096A) |
LiveResize | IDM_LIVERESIZE (0x095E) |
MultipleSelection | IDM_MULTIPLESELECTION (0x0959) |
Open | IDM_OPEN (0x07D0) |
Outdent | IDM_OUTDENT (0x088B) |
OverWrite | IDM_OVERWRITE (0x090A) |
Paste | IDM_PASTE (0x001A) |
PlayImage | IDM_DYNSRCPLAY (0x08DF) |
IDM_EXECPRINT (0x005D) | |
Redo | IDM_REDO (0x001D) |
Refresh | IDM_REFRESH (0x08FC) |
RemoveFormat | IDM_REMOVEFORMAT (0x08B6) |
RemoveParaFormat | IDM_REMOVEPARAFORMAT (0x08CD) |
RespectVisibilityInDesign | IDM_RESPECTVISIBILITY_INDESIGN (0x0965) |
SaveAs | IDM_SAVEAS (0x0047) |
SelectAll | IDM_SELECTALL (0x001F) |
SizeToControl | IDM_SIZETOCONTROL (0x0023) |
SizeToControlHeight | IDM_SIZETOCONTROLHEIGHT (0x0024) |
SizeToControlWidth | IDM_SIZETOCONTROLWIDTH (0x0025) |
Stop | IDM_STOP (0x085A) |
StopImage | IDM_DYNSRCSTOP (0x08E0) |
StrikeThrough | IDM_STRIKETHROUGH (0x005B) |
Subscript | IDM_SUBSCRIPT (0x08C7) |
Superscript | IDM_SUPERSCRIPT (0x08C8) |
TristateBold | IDM_TRISTATEBOLD (0x005F) |
TristateItalic | IDM_TRISTATEITALIC (0x0060) |
TristateUnderline | IDM_TRISTATEUNDERLINE (0x0061) |
UIOutdent | IDM_UI_OUTDENT (0x0967) |
UnBookmark | IDM_UNBOOKMARK (0x0850) |
Underline | IDM_UNDERLINE (0x003F) |
Undo | IDM_UNDO (0x002B) |
UnloadDocument | IDM_UNLOADDOCUMENT (0x096B) |
Unlink | IDM_UNLINK (0x084D) |
Unselect | IDM_CLEARSELECTION (0x07D7) |