Jump to content

WinRAR unpacking multiple files


Recommended Posts

Hi All

I'm coming back to an old script that I used to use to unpack several RAR files, one at a time. I used to use this script below

$windo = 'Laptop'
Dim $aArray[4]

While WinExists( $windo )
    $count = 0
    $aArray[0] = '0'
    $aArray[1] = '0'
    $aArray[2] = '0'
    $aArray[3] = '0'
    MsgBox(0, "Ready?","",5)
    MsgBox(0, "Details", "Title=" & $aArray[0] & @LF & "Handle=" & $aArray[1] & @LF & "Count=" & $aArray[2],5)
    
$var = WinList($windo)

For $i = 1 to $var[0][0]
  ; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1] & @LF & "Count=" & $count,5)
    $aArray[$count] = $var[$i][1]
;    MsgBox(0, "Details", "Title=" & $aArray[$count] )
    $count = $count + 1
    if $count > 3 then 
        $count = 0
        EndIf
    EndIf
    dosomething()
Next

WEnd

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

Func dosomething()
    WinSetTitle($windo,'','Unpacking')
    if $aArray[1] = '0' Then 
        ;EndIf
    Else
    MsgBox(0, "Ready?","" & $aArray[0] ,5)
        WinActivate($aArray[0])
        WinWaitActive($aArray[0])
        WinWaitClose($aArray[0])
        EndIf
    EndFunc


;WinWait('Extracting')
;AdlibEnable("check", 2000)
;While (1)
 ;AdlibEnable("check", 2000)
  ; Sleep(0100)
   ; myFunction()
    ;mySecondFunction()
;WEnd

;Func myFunction()
;   if not WinExists('Unpacking') Then
;   if not WinExists('Extracting') Then
 ;   If WinActive('Paused') Then
  ;      Send('c')
  ;  EndIf
;EndIf
;EndIf
;   Sleep(5000)
 ;   WinWaitClose('Unpacking')
;EndFunc   ;==>myFunction

;Func mySecondFunction()
 ;   If WinExists('Testing') Then
 ;       Sleep(5000); EMPTY (What are you wanting to do here?)
 ;   EndIf
 ;   If Not WinExists('Paused') Then
 ;       Sleep(6200)
 ;   EndIf
 ;   WinActivate('Paused')
;EndFunc   ;==>mySecondFunction

;Func check()
;   if WinExists('Extracting') Then
;       WinSetTitle('Extracting','','Unpacking')
;   EndIf
;   Sleep(500)
;   if WinExists('Extracting') Then
;       if WinExists('Unpacking') Then
;       MsgBox(64, "Info", "The message")
;       WinActivate('Extracting')
;       Send('p')
;   EndIf
;   EndIf
;EndFunc

but I want to update it. I have used a script which uses a UnRar.udf, but I don't want to go down that route again.

I want to automate this process (3. onwards)

1. select a rar file to unpack

2. rightclick/ unpack.( do this multiple times)

3. when "Unpacking...." window comes up, hit pause

4. then cycle though paused window, unpausing 1 at a time(waiting for it to finish before moving on to the next)

It needs to keep checking if there is any new WinRar window and add that to the list to process.

I thought of using WinList to get the name and PID, but then wasn't sure how to control the first window.

I could use something like

$var = WinList("[REGEXPCLASS:(Explore|Cabinet)]")
for WinRar, but I don't know how to find out what REGEXPCLASS to use. Autoit Window Info doesn't seem to tell me.

I am probably thinking this through too much and it can be done simply.

Any help would be great.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...