Why am I getting this error when I run a script?
<p>Sometimes  I get this error when running a script:</p>

<p><img src="https://i.stack.imgur.com/igMCT.png" alt="screen shot"></p>

<p>This one says "access is denied" but it sometimes says something different, though the problem is always with</p>

<pre><code>    While IE.readyState != 4 || IE.document.readyState != "complete" || IE.busy
        Sleep, 5
</code></pre>

<p>The intent of this code is to wait for the web page in internet explorer to finish loading. This is running with Internet Explorer 11.01 </p>

<p>Also this is how <code>IE</code> is defined</p>

<pre><code>IE := IEGetbyURL("stackoverflow.com/")

IEGetbyURL(URL) {   
    For pwb in ComObjCreate("Shell.Application").Windows
        If (pwb.LocationURL = URL and InStr(pwb.FullName, "iexplore.exe") &gt; 0)
        Return pwb
}
</code></pre>