0

The following code worked pre-Windows 10 to open a htm file in Internet Explorer set to specific size and screen position. Now in Windows 10 and IE11 I get multiple errors popup and the IE box size and position are not size. Any suggestions?

Batch File

Main() 
        Sub Main() 
             Force32bit() 
             Dim objExplorer : Set objExplorer = CreateObject("InternetExplorer.Application") 

             objExplorer.Navigate "G:\operational.htm" 
             objExplorer.ToolBar = 0 
             objExplorer.StatusBar = 0 
             objExplorer.Width = 280 
             objExplorer.Height = 1160
             objExplorer.Left = 1645
             objExplorer.Top = 0
             objExplorer.Visible = 1
             objExplorer.Menubar = 0
             objExplorer.Resizable = 1

        End Sub

         Sub Force32bit() 
             If InStr(UCase(WScript.FullName), "SYSTEM32") > 0 and CreateObject("Scripting.FileSystemObject").FolderExists("C:\Windows\SysWOW64") Then 
                 Dim objShell : Set objShell = CreateObject("WScript.Shell") 
                 objShell.CurrentDirectory = "C:\Windows\SysWOW64" 
                 objShell.Run "wscript.exe " & Chr(34) & WScript.ScriptFullName & Chr(34), 1, False 
             End If 
End Sub 

operational.htm

This is a plain HTML document with shortcut links to resources on the local drive and internet.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Operator</title>
    <link rel="stylesheet" href="../css/styles.css" type="text/css" />

    <script type="text/javascript">
    tday  =new Array("Sun","Mon","Tues","Wed","Thurs","Fri","Sat");
    tmonth=new Array("Jan","Feb","March","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec");

    function GetClock(){
    d = new Date();
    nday   = d.getDay();
    nmonth = d.getMonth();
    ndate  = d.getDate();
    nyear = d.getYear();
    nhour  = d.getHours();
    nmin   = d.getMinutes();

    if(nyear<1000) nyear=nyear+1900;

    if(nmin <= 9){nmin="0"+nmin}

    <!--+(nmonth+1)+-->
    document.getElementById('clockbox').innerHTML=""+nhour+":"+nmin+"hrs "+tday[nday]+", "+ndate+" "+tmonth[nmonth]+" "+nyear+"";
    setTimeout("GetClock()", 1000);
    }
    window.onload=GetClock;
    </script>

    <script type="text/javascript">

            function hideshow(which){
            if (!document.getElementById)
            return
            if (which.style.display=="block")
            which.style.display="none"
            else
            which.style.display="block"
        }
    </script>

</head>
 <body class="body">
    <div id="clockbox""></div>
    <br><B>MENU</b>

        <h1>Options</h1>

        ....

 </body></html>

I tried this code for testing but get a Windows Script Host error Line 8 Char 1 'unspecified error' error code 80004005.

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate "testing.htm"
objIE.ToolBar = 0
objIE.Menubar = 1
objIE.StatusBar = 0 
objIE.Width = 280 
objIE.Resizable = 1
objIE.Height = 600
objIE.Top = 10
On Error Resume Next
Do 
    If objIE.ReadyState = 4 Then
        If Err = 0 Then
            Exit Do
        Else
            Err.Clear
        End If
    End If
    WScript.Sleep 10
Loop
On Error Goto 0
Apples
  • 3
  • 3
  • Try to add extra wait loops right after `.Navigate` from [this answer UPD 3 and 4](http://stackoverflow.com/a/23232573/2165759). – omegastripes Apr 06 '17 at 19:28
  • What do you mean? Could you please provide an example? – Apples Jun 09 '17 at 10:15
  • I posted the link with examples in [this answer UPD 3 and 4](http://stackoverflow.com/a/23232573/2165759) – omegastripes Jun 09 '17 at 13:45
  • Thanks omegastripes but I can't get that to work. Could you show the compiled code sample. I was unable to get it to work looking at UPD 3 and 4. – Apples Jul 06 '17 at 13:14
  • Have you tried to implement that solution into your code? Please edit the question and add the code showing efforts. Also add what exact error do you have, and content of `G:\operational.htm`. – omegastripes Jul 06 '17 at 13:52
  • This is still an unsolved issue for me. I am again reviewing as there is a pending deadline for a working win10 solution. I have added details of the htm file, simple list menu. I am back reviewing UPD 3 and 4 as you previously mentioned. – Apples Nov 13 '17 at 00:01
  • Updated details of above. No error when navigating to a web address but the above discussed error occurs when opening a htm file. – Apples Nov 13 '17 at 04:23

0 Answers0