daddycaddy Posted March 15, 2017 Posted March 15, 2017 hi there, I'm very new at AutoIt, trying to learn... this is the AutoIt script I'm using now: expandcollapse popup#Include <GuiListbox.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <Array.au3> ;$sCmd = "rsync -vrtz --delete --progress /cygdrive/c/test2 177.0.0.1::asecretpwd" ; Test command $sCmd = "rsync.exe -v -rlt --progress --partial-dir=.rsync-partial --timeout=3600 'IP::FolderBackup/' '../'" $dir = "../" $size = DirGetSize($dir) $npid = Run($scmd, @ScriptDir, @SW_hide, "0x2") $nAutoTimeout = 10 ; Time in seconds to close window after finish $nDeskPct = 60 ; % of desktop size (if percent) $text = "" $days = "" ; $nHeight = 480 ; height/width of the main window (if fixed) ; $nWidth = 480 $sTitRun = "Executing process. Wait...." ; $sTitDone = "Process done" ; $sSound = @WindowsDir & "\Media\Ding.wav" ; End Sound $sButRun = "Cancel" ; Caption of "Exec" button $sButDone = "Close" ; Caption of "Close" button Opt("GUIOnEventMode", 1) if $nDeskPct > 0 Then $nHeight = @DesktopHeight * ($nDeskPct / 100) $nWidth = @DesktopWidth * ($nDeskPct / 100) EndIf If $CmdLine[0] > 0 Then $sCmd = "" For $nCmd = 1 To $CmdLine[0] $sCmd = $sCmd & " " & $CmdLine[$nCmd] Next EndIf ; AutoItSetOption("GUIDataSeparatorChar", Chr(13)+Chr(10)) $nForm = GUICreate($sTitRun, $nWidth, $nHeight) GUISetOnEvent(-1, "CloseForm") $nList = GUICtrlCreateList ("", 10, 200, $nWidth - 20, $nHeight - 250, $WS_BORDER + $WS_VSCROLL) GUICtrlSetFont (-1, 9, 0, 0, "Courier New") $nClose = GUICtrlCreateButton ($sButRun, $nWidth - 100, $nHeight - 40, 80, 30) GUICtrlSetOnEvent (-1, "CloseForm") GUISetState(@SW_SHOW) ;, $nForm) While 1 $sLine = StdoutRead($nPID) $text &= $sline&@CRLF If @error Then ExitLoop if StringLen ($sLine) > 0 then $sLine = StringReplace ($sLine, Chr(13), "|") $sLine = StringReplace ($sLine, Chr(10), "") if StringLeft($sLine, 1)="|" Then $sLine = " " & $sLine endif if $days = "" then $days = StringSplit($sline, " ") GUICtrlSetData ($nList, $sLine) _GUICtrlListBox_SetCurSel ($nList, _GUICtrlListBox_GetCount ($nList) - 1) EndIf Wend ;------------------- $sLine = " ||" GUICtrlSetData ($nList, $sLine) _GUICtrlListBox_SetCurSel ($nList, _GUICtrlListBox_GetCount ($nList) - 1) GUICtrlSetData ($nClose, $sButDone) WinSetTitle ($sTitRun, "", $sTitDone) If $sSound <> "" Then SoundPlay ($sSound) EndIf $rInfo = DllStructCreate("uint;dword") ; # LASTINPUTINFO DllStructSetData($rInfo, 1, DllStructGetSize($rInfo)); DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($rInfo)) $nLastInput = DllStructGetData($rInfo, 2) $nTime = TimerInit() While 1 If $nAutoTimeout > 0 Then DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($rInfo)) If DllStructGetData($rInfo, 2) <> $nLastInput Then ; Tocó una tecla $nAutoTimeout = 0 EndIf EndIf If $nAutoTimeout > 0 And TimerDiff ($nTime) > $nAutoTimeOut * 1000 Then ExitLoop EndIf Sleep (100) Wend Func CloseForm() Exit EndFunc sometimes rsync dies with connection reset by peer... how can I make my AutoIt restart the rsync in case it disconnected/stop working also, how can I make the AutoIt post the update on 1 line only? right now it's writing 1 line for each update...some of my files are huge that means I get a lot of lines in the console thank you for your help
daddycaddy Posted March 15, 2017 Author Posted March 15, 2017 I keep getting "Out Of Memory " messages and the AutoIt crashes...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now