title: Use AppActivate to change the active window
body: <p>I'm am trying to send some keystrokes to a program. I have some example code below which works fine up until the final <code>{Alt}</code> command. I believe this is due to the window name changing from <code>"Notepad1"</code> to <code>"NotePad2"</code>. Could anyone help me change the <code>AppActivate</code> path to <code>"Notepad2"</code> after the <code>objShell.SendKeys "{Enter}"</code> command?</p>
  
  <p>Example:</p>
  
  <pre><code>Set objShell = WScript.CreateObject("WScript.Shell")
  objShell.Run "Notepad.exe"
  Do Until Success = True
  Success = objShell.AppActivate("NotepadPathA")
  Loop
  objShell.SendKeys "{F1}"
  objShell.SendKeys "Secure06**"
  objShell.SendKeys "{Enter}"
  Shell.SendKeys "{Alt}"
  </code></pre>