I have changed the way of logging in to putty. Previously, it was done as standard, so when starting putty I added the session parameter and password. Now, before the password appears, I have to press "Enter" twice. In autohotkey I write simple scripts so I made it simple but the computer is sometimes loaded and not always the script will execute correctly. I found a script on the forum that executes commands based on reading the log file, but it does not want to work, although the indicated text appears in the logs. What is wrong ? In putty, I have set the log to be overwritten when the next window is started.
Code: Select all
logfile = %A_ScriptDir%\putty.log
run,C:\Program Files\PuTTY\putty.exe -load session
loop
{
Loop, read, %logfile%
last_line := A_LoopReadLine
if last_line=AFM-User
break
sleep 100
}
Send {Enter}
Send {Enter}
loop
{
Loop, read, %logfile%
last_line := A_LoopReadLine
if last_line=password
break
sleep 100
}
Send password{ENTER}
Return