Skip to content Skip to sidebar Skip to footer

Bring Spell Check Window To Foreground With JavaScript/JScript In Windows 7

I have some JScript code (converted from some old VBScript) that starts like this: var Word = new ActiveXObject('Word.Basic'); Word.FileNew(); // opens new Word document Word.Inse

Solution 1:

You might be able to jigger the window state. When the window is maximized after having been minimized, Windows will stack that in front (zIndex to top).

Something like:

 var WIN_MAX = 2;
 var WIN_MIN = 1;

 var Word = new ActiveXObject("Word.Application");
 Word.Visible = true;
 // minimize the app
 Word.WindowState = WIN_MIN ;
 // in 500ms, maximize
 setTimeout(function () {
     Word.WindowState = WIN_MAX;
 }, 500);

The setTimeout call seeks to work around a timing issue; Windows will sometimes "get confused" when a programmatic minimize/maximize happens in immediate succession. You might have to extend that delay a little, test it repeatedly and see what kind of results you get.


Post a Comment for "Bring Spell Check Window To Foreground With JavaScript/JScript In Windows 7"