...but even if I close the explorer window that was just opened and then run the exe again the problem shows up.
...can you provide concrete steps-to-reproduce?...something that's repeatable everytime...& when it's failing like that, what do you do to "reset" it, for another successful test?
I wrote this program, to simulate the "Enter Network Password" dialog/sequence...please save this file as
Enter Network Password.ahk...
Gui, New, , Enter Network Password
Gui, Margin, 19, 19
Gui, Add, Text, xm section w75, Username
Gui, Add, Edit, ys
Gui, Add, Text, xm section w75, Password
Gui, Add, Edit, ys
Gui, Add, Button, Default x0 y0 w0 h0 Hidden gSubmit, Submit
Gui, Show
return
GuiEscape:
GuiClose:
ExitApp
Submit:
Gui, Destroy
msgbox, , , Login Submitted, 1
Gui, New, , Bosch
Gui, Margin, 19, 19
Gui, Add, Text, , Bosch window
Gui, Show
return
...now, I did run your code, exactly as in the last post -- & it worked -- no matter how many times I tried...however, I have also re-written it, to clean it up, more like I would have written it...
#SingleInstance force
;//#NoTrayIcon
Username:="username"
Password:="password"
Run, Enter Network Password.ahk http://192.168.1.1:80
Sleep, 100
WinWait, Enter Network Password
if (!WinActive()) {
WinActivate
WinWaitActive
}
Sleep, 100
Send, {Raw}%Username%
Send, {Tab}
Send, {Raw}%Password%
Send, {Enter}
Sleep, 100
WinWait, Bosch
WinMaximize
ExitApp...so I don't really know what's causing your double typing...unless you still have old copies of the script running...have you rebooted?...or actually, test my above scripts before you reboot, then reboot & test them again.