Jump to content
Sign in to follow this  
Gerald

how can extract winrar using autoitscript

Recommended Posts

Gerald

can i extract winrar flie using autoit script

plss post your code

Share this post


Link to post
Share on other sites
Jos

can i extract winrar flie using autoit script

Just run winrar as a commandline using Run().

plss post your code

Give it a try first yourself. :) Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Inverted

WinRar comes with the commandline tool "Rar.exe" ! Use that :)

Share this post


Link to post
Share on other sites
Gerald

Run("WinRAR X LETTERS.RAR LETTER.TXT c:\work\misc")

this is my code i got the WinRAR X LETTERS.RAR LETTER.TXT c:\work\misc in to Winrar command line but wen i run the cod they do nothing plss help me :) show your Ex. Code ASP

Share this post


Link to post
Share on other sites
Inverted

You can't just run winrar from wherever, it's not in the path. You need the full path to the exe. Also, I'd first try using the commandline utility rar.exe instead of the normal winrar.exe

Example :

Run (@ProgramFilesDir & "\rar.exe your_parameters_here")

Share this post


Link to post
Share on other sites
Gerald

Run (@ProgramFilesDir & "\rar.exe WinRAR X LETTERS.RAR LETTER.TXT c:\work\misc") ok i do this but there is noting to do give me a Example code ......psssss

Share this post


Link to post
Share on other sites
Inverted

From a dos prompt you can run rar.exe and see its parameters.

Correct command is :

Run (@ProgramFilesDir & "\rar.exe x c:\whatever\LETTERS.RAR LETTER.TXT c:\work\misc")

You should use the full path to the rar file, for ease of use.

Edited by Inverted

Share this post


Link to post
Share on other sites
Gerald

how can i run rar.exe in dos prompt ..?

Share this post


Link to post
Share on other sites
Inverted

how can i run rar.exe in dos prompt ..?

start > run > cmd , then press enter, and in the dosprompt execute these commands :

cd %ProgramFiles%

cd winrar

rar

And see the help.

Share this post


Link to post
Share on other sites
happy2help

i use this code

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\Batch files\Icons\RARX.ico
#AutoIt3Wrapper_Compression=4
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <UnRAR.au3>
#include <File.au3>
#include <Array.au3>

Local $ArchiveFile[1]
Global $Cancel = False

HotKeySet("{Esc}", "_CancelUnpack")

$copy1 = FileInstall("C:\Users\Public\Backup\Batch files\Install Files\unrar.dll", "unrar.dll", 1)

$oFolder = "H:\To Burn\To Laptop\"
If Not FileExists($oFolder) Then $oFolder = "D:\Laptop\Unpacked\"; set for testing purposes
$iFolder = "H:\To Burn\"
If Not FileExists($iFolder) Then $iFolder = "D:\Laptop\Unpacked\"; set for testing purposes

$OutputFolder = FileSelectFolder("Browse for output path", $oFolder, 1)
If $OutputFolder = "" Then Exit                               ; if its cancelled then exit script
$InputFolder = FileSelectFolder("Browse for output path", $iFolder, 1)
If $InputFolder = "" Then Exit                                 ; if its cancelled then exit script
$ArchiveFile[0] = FileOpenDialog("Select the archive file", $InputFolder, "Archive files (*.rar)")
Do
$ask = FileOpenDialog("Select the archive file", $InputFolder, "Archive files (*.rar)")
if $ask = "" Then ExitLoop                                  ; if its cancelled then no more files to add
_ArrayAdd($ArchiveFile, $ask)
Until False
; Read in lines of text until the EOF is reached
For $x=0 To Ubound($ArchiveFile)-1
;Creates a user-defined DLL Callback function to process Unrar events
    $hUnRAR_CallBack = DllCallbackRegister("_UnRARProc", "int", "uint;int;int;int")

;Open RAR archive and allocate memory structures
    $hArchive = _RAR_OpenArchive($ArchiveFile[$x])
    If @error Then
        MsgBox(16, @error, "Archive open error")
        Exit
    EndIf

    $hArchive = _RAR_OpenArchive($ArchiveFile[$x])
    If @error Then
        MsgBox(16, "UnRAR", "Archive open error")
        Exit
    EndIf

;Set a user-defined callback function to process Unrar events
    _RAR_SetCallback($hArchive, $hUnRAR_CallBack)

;Read header of file in archive, performs action and moves the current position in the archive to the next file
;Also extract or test the current file from the archive
    $result = StringTrimLeft($ArchiveFile[$x], 20)
    $OutputFolder1 = $OutputFolder & "\" & @HOUR & @MIN
    SplashTextOn("Unpacking Now", "Unpacking " & $result & @CRLF & @CRLF & "Please wait a while." & @CRLF & @CRLF & $OutputFolder1, 800, 180)
    _Rar_UnpackArchive($hArchive, $OutputFolder1)
    If @error Then
        MsgBox(16, "UnRAR", "Archive unpacking error")
        Exit
    EndIf
    SplashOff()

    If $Cancel = True Then
        MsgBox(64, "UnRAR", "Unpacking cancelled")
    Else
        MsgBox(64, "Done", "Archive unpacked",2)
    EndIf

    DllCallbackFree($hUnRAR_CallBack)
Next

Func _CancelUnpack()
    $Cancel = True
EndFunc  ;==>_CancelUnpack

Func _UnRARProc($Msg, $UserData, $P1, $P2)
    Switch $Msg
        Case $UCM_PROCESSDATA;Return a positive value to continue process or -1 to cancel the archive operation
            If $Cancel = True Then Return -1
        Case $UCM_NEEDPASSWORD;DLL needs a password to process archive
            Local $iPassGet = InputBox("Password required", "Please type a password", "", "*", 300, 120)
            If $iPassGet = "" Then Return -1;If user cancelled password entering
            Local $PassBuffer = DllStructCreate("char[256]", $P1)
            DllStructSetData($PassBuffer, 1, $iPassGet)
            Return 1
        Case $UCM_CHANGEVOLUME;Process volume change
            If $P2 = $RAR_VOL_ASK Then;Required volume is absent
                Local $iVolGet = InputBox("Next volume required", "Please type a path to the next volume", "", "", 300, 120)
                If $iVolGet = "" Then Return -1;If user cancelled path entering
                Local $VolBuffer = DllStructCreate("char[256]", $P1)
                DllStructSetData($VolBuffer, 1, $iVolGet)
                Return 1
            EndIf
    EndSwitch
EndFunc  ;==>_UnRARProc

you need to search the forum for unrar.au3

Share this post


Link to post
Share on other sites
Gerald

thank you i do i found that you urar.au3..?

Share this post


Link to post
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
Sign in to follow this  

×