From: Marten on
In our login script, I have been using an Internet Explorer window to
display status messages as the process runs. The code that I use to
open IE is below.

Lately, the script has not been running through. It stops or pauses
before the window even opens. We have found that by removing the
Google toolbar on the PCs having trouble the script runs without
issue. I'm guessing that there is some type of update running by
Google that doesn't like my script.

Is there a way of specifying the "-extoff" option in the "with
objIntExplorer" options below?

I'm also thinking of putting a time limit on the objIntExplorer.Busy
and not do the status messages when it does time out.

Marten


Private Sub SetupIE (strTitle)

On Error Resume Next

'Dim strTitle 'Title of IE window
Dim intCount 'Counter used during AppActivate

'081120 strTitle = "Logon script status"

'Create reference to objIntExplorer
'This will be used for the user messages. Also set IE display
attributes
Set objIntExplorer =
Wscript.CreateObject("InternetExplorer.Application")
With objIntExplorer
.Navigate "about:blank"
.ToolBar = 0
.Menubar = 0
.StatusBar = 0
.Width = 600
.Height = 450 'was 350
.Left = 50
.Top = 50
End With

'Set some formating
With objIntExplorer.Document
.WriteLn ("<!doctype html public>")
.WriteLn ("<head>")
.WriteLn ("<title>" & strTitle & "</title>")
.WriteLn ("<style type=""text/css"">")
.WriteLn ("body {text-align: left; font-family: arial;
font-size: 10pt}")
'.WriteLn ("body {text-align: left; font-family: courier
new; font-size: 10pt}")
.WriteLn ("</style>")
.WriteLn ("</head>")
End With

'Wait for IE to finish
Do While (objIntExplorer.Busy)
Wscript.Sleep 200
Loop

'Show IE
objIntExplorer.Visible = True

'Make IE the active window
For intCount = 1 To 100
If objWshShell.AppActivate(strTitle) Then Exit For
WScript.Sleep 50
Next

End Sub
From: Tom Lavedas on
On Dec 7, 12:43 pm, Marten <absolut...(a)hotmail.com> wrote:
> In our login script, I have been using an Internet Explorer window to
> display status messages as the process runs. The code that I use to
> open IE is below.
>
> Lately, the script has not been running through. It stops or pauses
> before the window even opens. We have found that by removing the
> Google toolbar on the PCs having trouble the script runs without
> issue. I'm guessing that there is some type of update running by
> Google that doesn't like my script.
>
> Is there a way of specifying the "-extoff" option in the "with
> objIntExplorer" options below?
>
> I'm also thinking of putting a time limit on the objIntExplorer.Busy
> and not do the status messages when it does time out.
>
> Marten
>
> Private Sub SetupIE (strTitle)
>
>   On Error Resume Next
>
>   'Dim strTitle    'Title of IE window
>   Dim intCount    'Counter used during AppActivate
>
>   '081120 strTitle = "Logon script status"
>
>   'Create reference to objIntExplorer
>   'This will be used for the user messages. Also set IE display
> attributes
>   Set objIntExplorer =
> Wscript.CreateObject("InternetExplorer.Application")
>   With objIntExplorer
>     .Navigate "about:blank"
>     .ToolBar   = 0
>     .Menubar   = 0
>     .StatusBar = 0
>     .Width     = 600
>     .Height    = 450    'was 350
>     .Left      = 50
>     .Top       = 50
>   End With
>
>   'Set some formating
>   With objIntExplorer.Document
>     .WriteLn ("<!doctype html public>")
>     .WriteLn   ("<head>")
>     .WriteLn     ("<title>" & strTitle & "</title>")
>     .WriteLn     ("<style type=""text/css"">")
>     .WriteLn       ("body {text-align: left; font-family: arial;
> font-size: 10pt}")
>     '.WriteLn       ("body {text-align: left; font-family: courier
> new; font-size: 10pt}")
>     .WriteLn     ("</style>")
>     .WriteLn   ("</head>")
>   End With
>
>   'Wait for IE to finish
>   Do While (objIntExplorer.Busy)
>     Wscript.Sleep 200
>   Loop
>
>   'Show IE
>   objIntExplorer.Visible = True
>
>   'Make IE the active window
>   For intCount = 1 To 100
>     If objWshShell.AppActivate(strTitle) Then Exit For
>     WScript.Sleep 50
>   Next
>
> End Sub

Instead of creating the object, which does not take parameters, the
script must execute IExplore.exe with the parameter. Then it must
bind to that instance of IE. Here is one way ...

set owshshell = createobject("wscript.shell")

set oshellapp = createobject("shell.application")
oshellapp.shellexecute "iexplore.exe", "about:blank -extoff", _
"C:\Program Files\Internet Explorer"
For intCount = 1 To 100
If owshshell.AppActivate("about:blank") Then Exit For
WScript.Sleep 50
Next
if not owshshell.AppActivate("about:blank") then wsh.quit

for each wdw in oshellapp.windows
if instr(lcase(typename(wdw.document)),"htmldocument") <> 0 then
set objIntExplorer = wdw
objIntExplorer.Visible = false
exit for
end if
next

All of this replaces the CreateObject line.
_____________________
Tom Lavedas
From: Marten on
Thanks for the reply, TOm. I'll be trying your code later.

For the moment, I wrote a timeout around the "Wait for IE to finish"
part and just ignored using the status display.


wIEwait = 0
Do While (objIntExplorer.Busy)
Wscript.Sleep 200
wIEwait = wIEwait + 1
if wIEwait = wStatDispWait then exit do
Loop


On Mon, 7 Dec 2009 13:21:25 -0800 (PST), Tom Lavedas
<tlavedas(a)gmail.com> wrote:

>On Dec 7, 12:43�pm, Marten <absolut...(a)hotmail.com> wrote:

>
>Instead of creating the object, which does not take parameters, the
>script must execute IExplore.exe with the parameter. Then it must
>bind to that instance of IE. Here is one way ...
>
>set owshshell = createobject("wscript.shell")
>
>set oshellapp = createobject("shell.application")
>oshellapp.shellexecute "iexplore.exe", "about:blank -extoff", _
> "C:\Program Files\Internet Explorer"
> For intCount = 1 To 100
> If owshshell.AppActivate("about:blank") Then Exit For
> WScript.Sleep 50
> Next
>if not owshshell.AppActivate("about:blank") then wsh.quit
>
>for each wdw in oshellapp.windows
> if instr(lcase(typename(wdw.document)),"htmldocument") <> 0 then
> set objIntExplorer = wdw
> objIntExplorer.Visible = false
> exit for
> end if
>next
>
>All of this replaces the CreateObject line.
>_____________________
>Tom Lavedas