(マイコンピュータゾーンや信頼済みサイトから)インターネットゾーンなどに、IE.Navigate()するとき、保護モード: 無効 -> 有効 の場合は、現IEオブジェクトはそのままで、新規に別のIEオブジェクトとウィンドウが生成されるようです。
しかし、GUIでは、そういうことはないので、スクリプトでも可能なはずです。
Set wShell=CreateObject("WScript.Shell")
Path=wShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\iexplore.exe\")
Set Shell=CreateObject("Shell.Application")
Randomize
Do
FullName=UCase(Mid(Path,1,1))
For k=2 To Len(Path)
If Fix(Rnd*2) Mod 2 Then
FullName=FullName & UCase(Mid(Path,k,1))
Else
FullName=FullName & LCase(Mid(Path,k,1))
End If
Next
For k = Shell.Windows().Count To 1 Step -1
If Shell.Windows().Item(k - 1).FullName = FullName Then Exit For
Next
Loop While k
wShell.Run """" & FullName & """ -nohome",0
Do
For Each ie In Shell.Windows()
If ie.Visible Then
ElseIf ie.ReadyState<>0 Then
ElseIf ie.LocationURL<>"" Then
ElseIf ie.FullName=FullName Then
Exit Do
End If
Next
WScript.Sleep 100
Loop
ie.Visible=True
Navigate URL
Sub Navigate(URL)
hwnd=ie.HWND
LocationURL=ie.LocationURL
ie.Navigate URL
Do
If TypeName(ie)<>"IWebBrowser2" Then
For Each ie In Shell.Windows()
If hwnd=ie.HWND Then Exit For
Next
End If
If ie_LocationURL(ie)<>"" Then If LocationURL<>ie_LocationURL(ie) Then If Not ie.Busy Then If ie.ReadyState=4 Then Exit Do
WScript.Sleep 100
Loop
MsgBox ie.LocationURL
End Sub
Function ie_LocationURL(ie)
On Error Resume Next
ie_LocationURL=ie.LocationURL
End Function
ie.FullNameは、ドライブ名を除き、文字大小が保存される。ドライブ名は大文字固定。