I'm trying to create a script that creates a gui interface using Internet Explorer. The problem I'm running into is that when the gui is created, it always displays behind Directory Opus. I then have to click on the IE icon in the toolbar to bring it to the front. I have tried everything I can think of to bring it to the front automatically, but haven't been successful yet. If I use RunCommand to execute a program, it comes to the front immediately though. Am I missing something here? Am I doing something wrong? I've tried running this code from a button as well as using a hotkey. Any help that anyone can offer would be greatly appreciated. Here's the code that I'm using:
@script:vbscript
Function OnClick(ByRef ClickData)
Dim oIE, oShell
Set oIE = CreateObject("InternetExplorer.Application")
Set oShell = CreateObject("WScript.Shell")
oIE.Navigate "about:blank"
' oIE.AddressBar = False
' oIE.MenuBar = False
' oIE.StatusBar = False
' oIE.ToolBar = False
' oIE.Resizable = False
oIE.Width = 800
oIE.Height = 600
oIE.Document.Title = "My Script"
oIE.Document.body.innerHTML = "<p>Hello.</p>"
'Wait until IE is ready.
Do While oIE.Busy
DOpus.Delay 100
Loop
'Make IE visible and try to bring it to the front.
oIE.Visible = True
DOpus.Delay 500
oIE.Document.focus()
DOpus.Delay 500
oShell.AppActivate(oIE.Document.Title)
' DOpus.Delay 500
' oShell.AppActivate("Internet Explorer")
' ClickData.Func.Command.RunCommand "notepad.exe"
'Wait for the user to close the window.
Do While Err.Number = 0
DOpus.Delay 200
Loop
oIE.Quit
Set oIE = Nothing
Set oShell = Nothing
End Function 'OnClick
Thanks!
Jonathan