Jump to content

Search the Community

Showing results for tags 'rar.exe'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Im trying to write a small backup program using rar.exe. I am using $STDOUT_CHILD to make a log of added/updated files. Ive looked around and googled the subject, but I cant find out why im getting trunicated data from $STDOUT_CHILD. Does anyone have any ideas as to why this is happening or another method to get the full text from rar.exe. Thanks. Im getting output like: Update Time: 0h0m4s Exit Code: 0 Log: Creating archive c:backuptest.rar Adding c:bun5120717_0001.jpg Adding c:bun5120717_0002.jpg Adding c:bun5banner.psd Adding c:bun5eula.3082 - Copy.txt Adding c:bun5eula.3082.txt Adding c:bun5PHP and MySQL by Example.pdf Adding c:bun5utorrent.exe Adding data recovery record STD STDO STDOUT: Done Update Time: 0h0m1s Exit Code: 0 Log: Updating archive c:backuptest.rar Updating c:bun5eula.1028.txt Adding data recovery rec STDO STDO STDO STD STD STDO STDO STD STDO STD STDO STDOUT: Done Other times, filenames will be missing and there will be no closing comments (ie adding data recovery ...) #include <Process.au3> #include <Timers.au3> #include <Constants.au3> Global $Pid $hour = 3600000 $Err = '' $Out = '' $EXE = 'C:Progra~1WinRARrar.exe' $SRC = 'c:bun5*.*' $DST = 'c:backuptest.rar' $OPT = ' u -r -rr5p -v4500000 -x*.bak -x*.dwl -xplot.log -xthumbs.db -x*0_Temp_Saves_0 ' & $DST & ' ' & $SRC $WRTime = 0 While 1 ;If @HOUR > 1 and @HOUR < 8 and _Timer_GetIdleTime() > 1.0*$hour and NOT ProcessExists("Rar.exe") then If not ProcessExists("Rar.exe") then $Pid = Run($EXE & ' ' & $OPT, "",@SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) $hHandle = _ProcessGetHandle($Pid) $WRStart = _Timer_Init(); While ProcessExists("Rar.exe") $_StderrRead = StderrRead ( $Pid ) If Not @error And $_StderrRead <> '' Then $Err &= ( "STDERR: " & $_StderrRead & @Crlf ) $_StdoutRead = StdoutRead ( $Pid ) If Not @error And $_StdoutRead <> '' Then $Out &= ( "STDOUT: " & $_StdoutRead & @Crlf ) WEnd Local $WRTime = _Timer_Diff($WRStart) $iExitCode = _ProcessGetExitCode($Pid) _ProcessCloseHandle($hHandle) If $Out <> '' Then $TMP = StringReplace($Out,'',"") While StringInStr($TMP,"%") $PerLoc = StringInStr($TMP,"%") $TMP = StringReplace($TMP,StringMid($TMP,$PerLoc-4,5),"") ;removes xxx% WEnd $TMP = StringReplace($TMP, ' OK ','') $TMP = StringReplace($TMP, 'STDOUT:' & @CRLF,'') $TMP = StringReplace($TMP, 'STDOUT: ' & @CRLF,'') $TMP = StringReplace($TMP, 'STDOUT: ' & @CRLF,'') EndIf $LOG = FileOpen('c:backup' & @MDAY & '-' & @Mon & '-' & @Year & '.log',1) FileWrite($LOG, 'Update Time: ' & Time_Convert($WRTime) & @CRLF & 'Exit Code:' & @CRLF & $iExitCode & @CRLF & 'Log:' & @CRLF & $TMP & @CRLF & @CRLF ) FileClose($LOG) Sleep(12 * $hour) EndIf Sleep(0.5 * $hour) WEnd ; #FUNCTION# ==================================================================================================================== ; Name...........: _ProcessGetHandle() ; Description ...: Returns a handle from use of Run(). ; Syntax.........: _ProcessGetHandle($iPID) ; Parameters ....: $iPID - ProcessID returned from a Run() execution ; Return values .: On Success - Returns Process handle while Run() is executing (use above directly after Run() line with only PID parameter) ; On Failure - 0 ; Author ........: MHz (Thanks to DaveF for posting these DllCalls in Support Forum) ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ProcessGetHandle($iPID) ;Return handle of given PID Local Const $PROCESS_QUERY_INFORMATION = 0x0400 Local $avRET = DllCall("kernel32.dll", "ptr", "OpenProcess", "int", $PROCESS_QUERY_INFORMATION, "int", 0, "int", $iPID) If @error Then Return SetError(1, 0, 0) Else Return $avRET[0] EndIf EndFunc ;==>_ProcessGetHandle ; #FUNCTION# ==================================================================================================================== ; Name...........: _ProcessCloseHandle() ; Description ...: Closes a handle from use of Run(). ; Syntax.........: _ProcessCloseHandle($hProc) ; Parameters ....: $hProc - Process handle ; Return values .: On Success - Closes Process handle after a Run() has executed.; ; On Failure - 0 ; Author ........: MHz (Thanks to DaveF for posting these DllCalls in Support Forum), PsaltyDS ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ProcessCloseHandle($hProc) ;Close process handle Local $avRET = DllCall("kernel32.dll", "int", "CloseHandle", "ptr", $hProc) If @error Then Return SetError(1, 0, 0) Else Return 1 EndIf EndFunc ;==>_ProcessCloseHandle ; #FUNCTION# ==================================================================================================================== ; Name...........: _ProcessGetExitCode() ; Description ...: Returns a handle/exitcode from use of Run(). ; Syntax.........: _ProcessGetExitCode($hProc) ; Parameters ....: $hProc - Process handle ; Return values .: On Success - Returns Process Exitcode when Process does not exist. ; On Failure - 0 ; Author ........: MHz (Thanks to DaveF for posting these DllCalls in Support Forum), PsaltyDS ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _ProcessGetExitCode($hProc) ;Get process exit code from handle Local $t_ExitCode = DllStructCreate("int") Local $avRET = DllCall("kernel32.dll", "int", "GetExitCodeProcess", "ptr", $hProc, "ptr", DllStructGetPtr($t_ExitCode)) If @error Then Return SetError(1, 0, 0) Else Return DllStructGetData($t_ExitCode, 1) EndIf EndFunc ;==>_ProcessGetExitCode Func Time_Convert($TimeDiff) $hrs = 0 $min = 0 $sec= Round($TimeDiff/1000,0) if $sec>59 then $hrs = int($sec / 3600) $sec = $sec - $hrs * 3600 $min = int($sec / 60) $sec = $sec - $min * 60 EndIf return $hrs & "h" & $min & "m" & $sec & "s" EndFunc
×
×
  • Create New...