#include <Constants.au3>
Global $log_size = 0
Global $log_name = "C:\Documents and Settings\airat\Мои документы\Загрузки\log_file.log"
Opt("TrayIconDebug",1)
$hGUI = GUICreate("Возврат", 140, 90)
GUICtrlCreateLabel("Накладная №", 8, 8, 81, 17)
$iInput = GUICtrlCreateInput("", 8, 32, 125, 21)
$iButton = GUICtrlCreateButton("Вернуть на склад", 8, 56, 125, 25)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $iButton
FileDelete($log_name)
ShellExecute("C:\Documents and Settings\airat\Мои документы\Загрузки\putty.exe")
WinWait("PuTTY Configuration")
SendKeepActive("PuTTY Configuration")
Send("sdf.org")
Send("{TAB 12}{DOWN}!p{TAB}")
Send($log_name)
Send("{TAB 2}{UP 2}!o")
SendKeepActive("[CLASS:PuTTY]")
ConsoleWrite(WaitResult("login as: "))
Send("new{ENTER}")
ConsoleWrite(WaitResult("[RETURN] "))
Send("{ENTER}")
ConsoleWrite(WaitResult("login: "))
Send("new{ENTER}")
ConsoleWrite(WaitResult("Are you using Windows 2K or XP? (Y/N) "))
Send("y")
ConsoleWrite(WaitResult("Please press your BACKSPACE key: "))
Send("{BACKSPACE}")
EndSwitch
WEnd
Func WaitResult($end_with)
Local $buff, $new_size = -1, $_new_size
$log_size = FileGetSize($log_name)
$_new_size = $log_size
While 1
Sleep(100)
$new_size = FileGetSize($log_name)
If $_new_size < $new_size Then
$buff = FileRead($log_name)
$buff = StringMid($buff, $log_size+1)
If StringInStr($buff, $end_with) <> 0 Then Return $buff
$_new_size = $new_size
EndIf
WEnd
EndFunc