Winrar buttons on command bar

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
ZoSTeR
Power Member
Power Member
Posts: 1049
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

The current solution will never work with multiple archives (not multi part/volume).

The way that the Rar extention works is as follows:

Code: Select all

winrar x -iext "-an=c:\archive1.zip" -- "c:\archive2.zip" "d:\desfolder\"
Any additional archive file is passed as a parameter ("-an="). No chance without some scripting.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

2ZoSTeR,

Can it be done where multiple archives would get unpacked to their own folder with a button in the button bar?
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1049
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

This is a basic AutoIt script. Just adjust the winrar path, compile and add as button with %P%S %T.

Code: Select all

Dim $i_NumberOfParams, $s_DestPath, $s_RarString
$i_NumberOfParams = $cmdline[0]
If $i_NumberOfParams < 2 Then
	MsgBox(0,"Error","Parameters: Archivefiles ... DestPath")
	Exit
EndIf
$s_DestPath =$cmdline[$i_NumberOfParams]
For $i = 1 to $i_NumberOfParams - 2
	$s_RarString &= ' "-an=' & $cmdline[$i] & '"'
Next
$s_RarString &= ' -- "' & $cmdline[$i_NumberOfParams - 1] & '" ?' & $s_DestPath
$s_FinalRarString = "c:\program files\winrar\winrar.exe x -iext" & $s_RarString
Run($s_FinalRarString)
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

Ok, that worked partially. It unpacks it to the main source directory and unpacks them all to the same directory. not individual archive named directories. I used Aut2exe.exe to compile it. Did I do it wrong?
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1049
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

For extraction into separate folders add the switch "-ad". This prevents the "Extraction path and options" dialog from appearing despite the "?" in front of the destination path.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

Like this?

Code: Select all

$s_FinalRarString = "c:\program files\winrar\winrar.exe x -iext -ad" & $s_RarString
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1049
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

Boofo wrote:Like this?
Yes exactly.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

Well. something else is wrong then. It still extracts them all to the same folder and does it in the source main directory, not the target. The extract options box asking for the path still comes up also.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1049
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

The statement i made above about the extraction dialog is actually wrong. You have to remove the "?" in front of the DestPath.

Code: Select all

$s_RarString &= ' -- "' & $cmdline[$i_NumberOfParams - 1] & '" ' & $s_DestPath
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

Ok, that worked great! But it still unpacks the files to the source and not the target.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1049
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

One thing should be changed for paths with spaces in it. Parameter:

Code: Select all

%P%S "%T"
and

Code: Select all

$s_RarString &= ' -- "' & $cmdline[$i_NumberOfParams - 1] & '" "' & $s_DestPath & '"'
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

I had added %P%S "%T" but without the line change in the au3 file, it gave an error. It all works correctly now. Thank you very much. I wish I had your skill in the AutoIt scripting. I can think of a thousand uses for something like this.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1049
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

Glad it works now. Those spaces allways come back to haunt me ;)

You should give AutoIt a try. It's really simple yet very powerful. The help files is extensive and every command comes with some sample code. Don't forget to get their excellent editor.
User avatar
Boofo
Power Member
Power Member
Posts: 1431
Joined: 2003-02-11, 00:29 UTC
Location: Des Moines, IA (USA)
Contact:

Post by *Boofo »

I downloaded the package and will look at it. I also grabbed the editor (SciTE4AutoIt3.zip), but I'm kind of partial to EditPlus. I may contact you again if I have any questions about the coding part of it, if that is ok. And thanks again for all the help.
chmod a+x /bin/laden -- Allows anyone the permission to execute /bin/laden

How do I un-overwrite all my data?

User of Total Commander
#60471 Single user license
Post Reply