title: Reading a file in internet explorer temp folder
body: <p>I have A VBScript that navigates to an Internet Explorer page which stores a file called "123.txt" in my Temp internet Folder.  In this text file is a line that reads "Key=1234567"  I am trying to make a script that retrieves this key and displays it in a message box.  My problem is that the temp folder is a virtual folder and the files cannot be read like a normal file.</p>
  
  <pre><code>       Const TEMPORARY_INTERNET_FILES = &amp;H20&amp;
  
  
      Dim WshShell = CreateObject("WScript.Shell")
  
  
  
      Dim objShell = CreateObject("Shell.Application")
      Dim objFolder = objShell.Namespace(TEMPORARY_INTERNET_FILES)
      Dim objFolderItem = objFolder.Self
  
  
  
  
  
      Dim ie = CreateObject("InternetExplorer.Application")
      ie.visible = True
      ie.navigate2("myUrl")
  
      While (ie.busy)
          wscript.Sleep(1)
      End While
  
      Dim f As StreamReader
      Dim colItems = objFolder.Items
      For Each objItem In colItems
  
          If InStr(objItem.name, "123.txt") &lt;&gt; 0 Then
                              Dim sr As StreamReader = New StreamReader(Str(objFolderItem.path &amp; "\" &amp; objItem.name))
              Do While sr.Peek() &gt;= 0
               dim line = sr.ReadLine()
               if(instr(line,"key")&lt;&gt;0) then 
                    key = line
               end if
              Loop
          End If
      Next
  </code></pre>
  
  <p>msgbox key    </p>