WhiteCrow Posted December 4, 2005 Posted December 4, 2005 What this script does: It will ask you where to process files, and then it will automaticly find all par- and rar-able files. It will then process all Par files and after thats finished it will extract all files to chosen directory. This are the prequisites: 1. Quickpar needed (preferably with the option automatic repair enabled) 2. WinRar needed Have fun, and critisism welcome (and i already know, i write redundant code ) I would like to add this to the contextmenu of windows, any ideas on that ? expandcollapse popup#include <File.au3> #include <Array.au3> Opt("WinTextMatchMode", 2) Opt("WinSearchChildren", 1) Dim $filter[6] Dim $temprar[1] Dim $temppar[1] Dim $failed [1] $count=0 $inifilenpath=@ScriptDir & "\" & "parrar.ini" $gogogo=1 $gogo=0 $n=0 $DownDir=IniRead ( $inifilenpath, "DownloadBaseDir", "DownDir", "not found" ) if $DownDir="not found" then $DownDir=FileSelectFolder ( "What is your most used Downloading directory ?(the root of that)", "") IniWrite ( $inifilenpath, "DownloadBaseDir", "DownDir", $Downdir ) endif $winrarpath=IniRead ( $inifilenpath, "WinRarDir", "WinRar", "not found" ) if $winrarpath="not found" then $winrarpath=FileOpenDialog("What is the location of Winrar ?", "", "Rar.exe (Rar.exe)", 1 + 2, "Rar.exe" ) IniWrite ( $inifilenpath, "WinRarDir", "WinRar", $winrarpath) endif $deletedir=IniRead ( $inifilenpath, "DeleteDir", "Delete", "not found" ) if $deletedir = "not found" then $yesno=msgbox(4, "Delete or Not", "Do you want PaRRaR to ask if you want to delete the processdir after each run ?" & @CR & "This option also gives you some more stats when your done processing.") if $yesno = 6 then Iniwrite ( $inifilenpath, "DeleteDir", "Delete", "yes" ) else Iniwrite ( $inifilenpath, "DeleteDir", "Delete", "no" ) endif MsgBox(0, "Settings", "Settings Done, written in parrar.ini (same place as parrar.exe)" & @CR & "Change the .ini if you like, or delete parrar.ini to reset the settings, and be asked these questions again.") endif $path=FileSelectFolder ( "Wich directory do you want to process the Par and Rar files from ? ", $DownDir) $deleteyes=$path $path=StringReplace ( $path, " ", '"' & " " & '"') $filter[0]="*.rar" $filter[1]="*.part001.rar" $filter[2]="*.par" $filter[3]="*.part01.rar" $filter[4]="*.part1.rar" $filter[5]="*.001" $rar=_FileListToArray($path, $filter[0], 0) if $rar <> "" then $end=Ubound($rar) Do $n=$n+1 $teststring=_ArrayToString($rar, @CR, $n, $n) $found=StringInStr ($teststring, ".part") Select case $found=0 _ArrayAdd ($temprar, $teststring) EndSelect Until $n=$end -1 $rar=$temprar $n=0 endif $par=_FileListToArray($path, $filter[2], 1) ;_ArrayDisplay ( $par, "pars" ) if $par <> "" then $end=Ubound($par) Do $n=$n+1 $teststring=_ArrayToString($par, @CR, $n, $n) $found=StringInStr ($teststring, ".vol") Select case $found=0 _ArrayAdd ($temppar, $teststring) EndSelect Until $n=$end -1 _ArraySort($temppar) $par=$temppar $n=0 endif $part001=_FileListToArray($path, $filter[1], 1) if $part001 <> "" then $end=Ubound($part001) Do $n=$n+1 _ArrayAdd ($rar, $part001[$n]) Until $n=$end -1 $n=0 endif $part01=_FileListToArray($path, $filter[3], 1) if $part01 <> "" then $end=Ubound($part01) Do $n=$n+1 _ArrayAdd ($rar, $part01[$n]) Until $n=$end -1 $n=0 endif $part1=_FileListToArray($path, $filter[4], 1) if $part1 <> "" then $end=Ubound($part1) Do $n=$n+1 _ArrayAdd ($rar, $part1[$n]) Until $n=$end -1 $n=0 endif $n001=_FileListToArray($path, $filter[5], 1) if $n001 <> "" then $end=Ubound($n001) Do $n=$n+1 _ArrayAdd ($rar, $n001[$n]) Until $n=$end -1 $n=0 endif _ArraySort($rar) MsgBox(0, "" , $rar[1]) if $rar="" then MsgBox(0, "PaRRaR", "No files found to extract.") exit endif $whereto=FileSelectFolder ( "Where do you want to extract the RAR files to ?", "") $whereto=StringReplace ( $whereto, " ", '"' & " " & '"') $whereto= $whereto & '"' $n=0 $end=Ubound($par) Do $n=$n+1 $teststring=_ArrayToString($par, @CR, $n, $n) $found=StringInStr ($teststring, " ") if $found <> 0 then $vari=StringReplace ( $teststring, " ", '"' & " " & '"') _ArrayDelete ( $par, $n ) _ArrayAdd ($par, $vari) endif Until $n=$end -1 _ArraySort($par) $n=0 $end=Ubound($rar) Do $n=$n+1 $teststring=_ArrayToString($rar, @CR, $n, $n) $found=StringInStr ($teststring, " ") if $found <> 0 then $vari=StringReplace ( $teststring, " ", '"' & " " & '"') _ArrayDelete ( $rar, $n ) _ArrayAdd ($rar, $vari) endif Until $n=$end -1 _ArraySort($rar) $n=0 if $par <> "" then $end=Ubound($par) Do $n=$n+1 $parpath=$path & "\" $parfile=$par[$n] & '"' Run (@COMSPEC & " /c " & '"' & "start " & $parpath & $parfile) Do $title = WinGetTitle("QuickPar") Sleep(2500) Select Case StringInStr ($title, "All Data Verified") <> 0 $gogo=1 $gogogo=2 Case StringInStr ($title, "Repair Succeeded") <> 0 $gogo=1 $gogogo=2 Case StringInStr ($title, "blocks") <> 0 $gogo=2 $gogogo=2 Case StringInStr ($title, "Select more recovery volumes") <> 0 $gogo=2 $gogogo=2 EndSelect Until $gogogo=2 $gogogo=1 $gogo=0 If $gogo=2 then _ArrayAdd ($failed, $par[$n]) endif Winclose($title) Sleep(1000) Until $n=$end -1 $n=0 endif if $rar <> "" then $winrarpath=StringReplace ( $winrarpath, " ", '"' & " " & '"') $n=0 $end=Ubound($rar) Do $n=$n+1 $rarpath=$path & "\" $rarfile=$rar[$n] Run (@COMSPEC & " /c " & '"' & "start " & $winrarpath & " x " & "-o- " & "-- " & $rarpath & $rarfile & " " & $whereto) do sleep(2500) until ProcessExists ( "rar.exe" ) = 0 Until $n=$end -1 $n=0 endif MsgBox (0, "", "All files Done!", 4) $yesno=MsgBox(4, "", "Do you want to delete the directory ?" & @CR & $deleteyes ) If $yesno=6 then DirRemove ( $deleteyes, 1 ) else $msgbox(0, "Allright", "You chose No, directory not deleted", 4) endif
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