I'm am trying to send some keystrokes to a program. I have some example code below which works fine up until the final {Alt} command. I believe this is due to the window name changing from "Notepad1" to "NotePad2". Could anyone help me change the AppActivate path to "Notepad2" after the objShell.SendKeys "{Enter}" command?
Example:
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}"