I'm attempting to write an HTA that to allow users to toggle the IE proxy
server between one of two servers we use or toggle it between enabled and
disabled. We have IE setup so proxy settings are per machine so, as far as
I can tell, that should put me addressing only these two keys...

(string) HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings\ProxyServer
(dword) HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings\ProxyEnable

I can change the keys with a script, but when I go into the browser and
drill down through the tools menu the changes don't appear.

Anyone know why that is?

Thanks,

Tom

Re: Changing IE Settings by Slim

Slim
Thu Apr 06 15:45:52 CDT 2006

I think you need to close and open IE

http://www.visualbasicscript.com/m_26837/tm.htm


"Tom Ker" <thomasDOTkerA@Thighmark.com> wrote in message
news:eJbd2hbWGHA.1352@TK2MSFTNGP05.phx.gbl...
> I'm attempting to write an HTA that to allow users to toggle the IE proxy
> server between one of two servers we use or toggle it between enabled and
> disabled. We have IE setup so proxy settings are per machine so, as far
> as I can tell, that should put me addressing only these two keys...
>
> (string) HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
> Settings\ProxyServer
> (dword) HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
> Settings\ProxyEnable
>
> I can change the keys with a script, but when I go into the browser and
> drill down through the tools menu the changes don't appear.
>
> Anyone know why that is?
>
> Thanks,
>
> Tom
>



Re: Changing IE Settings by Tom

Tom
Fri Apr 07 11:08:17 CDT 2006

Excellent! Thanks, Slim.


"Slim" <me@here.com> wrote in message
news:%23cl7qsbWGHA.128@TK2MSFTNGP05.phx.gbl...
>I think you need to close and open IE
>



Re: Changing IE Settings by Tom

Tom
Tue Apr 11 13:10:53 CDT 2006

One more quick question...

While I'm doing this loop to close the open IE sessions...

While oShell.AppActivate("Internet Explorer")
oShell.SendKeys "%{F4}"
WScript.Sleep 500
Wend

Is there a way to capture the URL from each IE session before it closes so I
can open them up back at the same place? I can handle writing and reading
the array I'd have to build, but I'm just not sure how to grab the URL from
each activated IE window.

Thanks,

Tom



Re: Changing IE Settings by Slim

Slim
Wed Apr 12 07:58:24 CDT 2006

yourIEobject.LocationURL


"Tom Ker" <thomasDOTkerA@Thighmark.com> wrote in message
news:O6J9HNZXGHA.3496@TK2MSFTNGP05.phx.gbl...
> One more quick question...
>
> While I'm doing this loop to close the open IE sessions...
>
> While oShell.AppActivate("Internet Explorer")
> oShell.SendKeys "%{F4}"
> WScript.Sleep 500
> Wend
>
> Is there a way to capture the URL from each IE session before it closes so
> I can open them up back at the same place? I can handle writing and
> reading the array I'd have to build, but I'm just not sure how to grab the
> URL from each activated IE window.
>
> Thanks,
>
> Tom
>



Re: Changing IE Settings by Tom

Tom
Wed Apr 12 09:48:39 CDT 2006

Thanks Slim.

.LocationURL didn't work, but GoogleGroups led me to .location.href that
does work.

I'm getting closer, but I'm still not quite there. Below is part of the
code I'm testing. It works great when run in TEST.VBS, but I get
"permission denied: href" when run in TEST.HTA. With locationURL I get a
method or property not supported message in both cases. The HTA is seeing
the web page OK because oShellApp.windows.item(i).document.title returns the
correct string.

Any thoughts?

Thanks...


Set oShell = CreateObject("WScript.Shell")
Set oShellApp = CreateObject("Shell.Application")
Dim aURLList()

'collect URLs from open IEs
iURLCnt = 0
For i = 0 to oShellApp.windows.count - 1
On Error Resume Next
bHTMLDoc =
CBool(InStr(LCase(TypeName(oShellApp.windows.item(i).document)),"htmldocument"))
If err <> 0 Then bHTMLDoc = FALSE
On Error GoTo 0
If bHTMLDoc Then
ReDim Preserve aURLList(iURLCnt)
aURLList(iURLCnt) = oShellApp.windows.item(i).document.location.href
iURLCnt = iURLCnt + 1
End If
Next

'close all open IEs
While oShell.AppActivate("Internet Explorer")
oShell.SendKeys "%{F4}"
oShell.Run "ping.exe -n 1 127.0.0.1", 0, True
Wend

'sleep for 2 seconds just for effect
oShell.Run "ping.exe -n 2 127.0.0.1", 0, True

'reopen IEs with collected URLs
For i = 0 to iURLCnt - 1
oShell.run "iexplore.exe " & aURLList(i)
Next