0

I'm trying to manipulate Word from an HTA file application. Currently, when I open word, it opens underneath my application. I'd like to open it on top. I've tried using the following JScript to give Word the focus:

wshShell = new ActiveXObject("WScript.Shell");
wshShell.AppActivate(doc.windows.Item(1).caption);

This works, and word gets focus, but on Windows 7 it stays underneath my app. Is there something else I need to do to bring word to the top?

rjmunro
  • 27,203
  • 20
  • 110
  • 132
  • I tested this, and AppActivate does bring a window to the front (tested on Windows 7). However, it will not restore a minimized window. – Andy E Jun 14 '10 at 17:02
  • Maybe there is a setting somewhere that allows windows to be active but not on the top. I've tried calling the above after a 2.5 second delay, and it's clear when word gets the focus, but it doesn't come to the top. I'll see if I can try it on some more computers. – rjmunro Jun 15 '10 at 14:53

1 Answers1

1

If you can't force that window to the front, send your own window to the back!

Try this:

<script>
window.blur();
</script>

That should send your current window to the background.

BoltBait
  • 11,361
  • 9
  • 58
  • 87