If $CmdLine[0] = 0 Then Exit _Regulardownload($CmdLine[1], $CmdLine[2]) Func _Regulardownload($bat, $name) Local $Pid, $Text, $Percent ProgressOn("Download", "Загрузка " & $name) $Pid = Run($bat, '', @SW_HIDE, 2 + 4) While 1 $Text = StdoutRead($Pid, False, False) If @error Then ExitLoop $Text = StringStripWS($Text, 1 + 2 + 4) If StringRegExp($Text, '\(\d+%\)') Then $Text = StringTrimLeft(StringTrimRight($Text, 1), 9) If StringInStr($Text, 'ETA:') Then $Text = StringRegExpReplace(StringReplace($Text, '(', ' ('), ' CN:[^ ]+ DL:[^ ]+ ETA:', ' / ') Else $Text = StringRegExpReplace(StringReplace($Text, '(', ' ('), ' CN:[^ ]+ DL:[^ ]+', '') EndIf $Percent = StringRegExpReplace($Text, '(?s)[^\(]+\((\d+)%\).*', '\1', 1) ProgressSet(Number($Percent), $Text) EndIf WEnd ProgressOff() EndFunc |