Archive: Plugin to extract 7-Zip 4.10 files


Plugin to extract 7-Zip 4.10 files
  Is there a plug-in that can decompress archives created by 7-zip v4.12? I would like to use 7Zip to decrease the size of my downloadable components.

Cheers!


You'll have to use 7-Zip's command-line 7z.exe program to decompress 7z files.

You should compress it into your installer, and place it in a folder (e.g. $PLUGINSDIR) on run-time then execute it with nsExec::Exec.

-Stu


Originally posted by Afrow UK
You'll have to use 7-Zip's command-line 7z.exe program to decompress 7z files. You should compress it into your installer, and place it in a folder (e.g. $PLUGINSDIR) on run-time then execute it with nsExec::Exec.
Bummer. Thanks for the info - I was hoping I could use a native NSIS plug-in and get the same feedback as ZipDLL does. Oh well, I guess nothing on the horizon on this front? ;)

You can use nsExec::ExecToLog to stream the 7z output directly to the installation progress window.

-Stu


7zip went final 7.20.

I would appreciate a plugin using 7zip for archiving like
"nsexec::7zip '"c:\temp\*.txt" /switch'
or another built-in solution...

WinRAR also uses a newer 7zxa.dll instead an bigger exe 7za.exe


Update:

I'm a making a plugin for decompressing 7z files (~60KB DLL), but I need to know if theres one already...

:)


Joel! Just go ahead and make it.


If one doesn't really need the 7z format and just wants to use the LZMA compression method, then there is also the ExtractDLLEx or untgz plugins.


Some time ago I wrote a simple plugin for uncompressing 7z files with progress reporting. It was based on the console sfx with changed console interface to some kind of nsis wrapper. It was big enough (144 kb), but due to size (32 mb to 27 mb from nsis lzma to 7z file) and time (i've used archive as merge module, which never changes) economy, that really doesn't matter for me.
However I've lost one of my hdd's some weeks ago, so at present time I have no source code of that plugin, just compiled dll.

SetOutPath $INSTDIROCRFREBin

>; increase size
AddSize 85000
>; use precompressed 7zip fre file
SetCompress off
DetailPrint "Extracting FineReader Engine..."
>File /a "Misc\frebin.7z"
>SetCompress auto
DetailPrint "Installing FineReader Engine..."
>nsis7z::Extract "frebin.7z"
>Delete "$INSTDIR\OCR\FRE\Bin\frebin.7z"

Since the source code for the 7-zip project is open-source there shouldn't be hard to implement this. I might have a crack at it sometime as well. But I don't know about the time. I wrote my own version of unzip plug-in for NSIS one time (based on source code for NSIS' Zip2EXE) and if 7-zip has some easy to use interface it will be doable.


Any Update on this plugin?


why should it ?


Ah, Sorry... I mean if there was an updated copy of this plugin with the updated 7-zip files. This plugin's 7zip files aren't up to date, and the source code's not provided (ala 7zip licence). So I just wanted to ask if there was any update on the status of the plugin.

Owen.


write to the author pls


Nsis7z plugin updated
  Hello everyone ;)

I've spent some time to rewrite (due to lost source code) Nsis7z plugin using the latest 7z (4.64), this time the source code is available, so no one should have problems using/distributing it.

This plugin allows our company to create merge-modules (as 7z archives) with prepacked files used in every release, saving some space (due to better compression ratio) and time (60mb 7z archive compiles to NSIS setup in several seconds, compare that with the time required to pack 250mb of original files).

This post - complete distribution with source, next - stripped with plugin and example only.

Best regards, Nik.


Nsis7z (based on 7z 4.64) binary distribution.


Can it extract to a different directory and without paths? To do the equivalent of this command: 7za.exe e "downloadedfileusingnsisdl.7z" -o"$INSTDIR\some\path" -y eliminating the middle-man.


first of all, thanks for this great plugin.. i was looking for this for ages!

i was wondering, if it would be easy to add support to create 7z files (or make it a seperate plugin).

about decompression, i'm looking for a way to create a similiar dialog like the inbuild "unpacking data" at the launch of (huge) installers. i guess i could use a banner plugin, but can i display the unpacking status in there? i guess the 7z would have to support this in a way?


does this plugin handle passwords? does it report if an archive is protected by password?


Hi,

I've just found your plugin and its great.
Question: Does it respect the SetOverWrite value?


Originally posted by dbach Question: Does it respect the SetOverWrite value?
To answer myself (;)) no, it doesnt.

Bug:
- Files not ending with .7z are not extracted (e.g. rename product.7z -> product.001, try extraction)

Featurewish:
- Nsis7z should respect SetOverwrite

Thanks :)

I actually wrote something along these lines myself awhile back, just a header that uses 7za.exe... It can extract and create archives of any type supported by 7-zip, as well as practically all of the command-line functionality of 7za.exe (except test archive). If anyone is interested I'd be happy to post the header.


Originally posted by qwertymodo
I actually wrote something along these lines myself awhile back, just a header that uses 7za.exe... It can extract and create archives of any type supported by 7-zip, as well as practically all of the command-line functionality of 7za.exe (except test archive). If anyone is interested I'd be happy to post the header.
Sure, go for it - the more the btter. Thanks a lot.

Ok I will. I just got into testing it more thoroughly than just what I needed when I first wrote it and there were a few weird bugs... I think I have them tracked down, so I'll post it soon.


Here's my header. I am fairly certain that it works properly, but I wouldn't be surprised if some weirdness exists still. Sorry for the lack of documentation, the basic function calls are outlined in the comment at the top of the file. You'll need 7za.exe in the NSIS plugins directory to use it.


Thanks a lot for this. :)


Something that I should have mentioned was that "other parameters" can be ANY 7-zip flags (should be at least...), so read the 7-zip documentation for things that you can put into other parameters. Basically whatever you put there just gets appended to the end of the command-line call, so if it works in a command-line call it should work there.


Is there any documentation about nsis7z.dll returned error ?
I mean
- file to extract not found
- error during extraction
- etc...

maybe someone here knows...


i'm really glad this plugin exists, because i prefer this over using an external program. however, this would even be better if there was a way to use (some of the) switches 7zr.exe offers. personally i'm looking for a way to extract a specific file from an archive only, right now i have to use 7zr/7za to do the task.


hi guys, this plugin can extract rar files too???


Originally posted by thanatos83
hi guys, this plugin can extract rar files too???
Hi thanatos83, you need to read a little further ;)
Since the plugin reads files from 7zip, let's got its site, quote from there:
Supported formats:

* Packing / unpacking: 7z, ZIP, GZIP, BZIP2 and TAR
* Unpacking only: ARJ, CAB, CHM, CPIO, DEB, DMG, HFS, ISO, LZH, LZMA, MSI, NSIS, RAR, RPM, UDF, WIM, XAR and Z.
How about that :D

Plugin breaks non ANSI file pathname encoding (for example it switches from cyrillic 1251 to 866, this causes shortcut creation into inproper places).

Here's a fix.


Hi...

I need a help please with this plugin... I read the wiki about the usage of this plugin, like this:

Unpack you merge module as 7z archive to somewere on users harddrive, set target dir for archive contents with SetOutPath, and call plugin.

My question is:

when this say merge module it is referred to standalone file 7za.exe???


I think that line is trying to say "unpack your 7z archive using the File command, then use SetOutPath to set the extraction output directory and call the plugin."


OK ,so i saw that example but before from command script File you can see SetCompress off. But i think about the file command, it compress that 7z into setup.exe (so SetCompress off is not working?)

This plugin first copy 7z into harddrive and then extracts the contents???

I was searching for a long time a plugin that allow me to extract contents froms some 7z files with an animated bar but only i need to extract it from fixed media like DVD. So I need to make a little setup.exe...

thanks.

P.D.

Sorry admin about duplicate post, please delete one...


OK ,so i saw that example but before from command script File you can see SetCompress off. But i think about the file command, it compress that 7z into setup.exe (so SetCompress off is not working?)

This plugin first copy 7z into harddrive and then extracts the contents???

I was searching for a long time a plugin that allow me to extract contents froms some 7z files with an animated bar but only i need to extract it from fixed media like DVD. So I need to make a little setup.exe...

thanks. :)


Originally posted by thanatos83
OK ,so i saw that example but before from command script File you can see SetCompress off. But i think about the file command, it compress that 7z into setup.exe (so SetCompress off is not working?)
No, the command only makes NSIS turn off compression. Of course it still stores the file in the installer, otherwise it wouldn't be able to extract the file when the File command is called during installation. Turning off compression only helps by making the installer compilation go faster.

Originally posted by thanatos83
This plugin first copy 7z into harddrive and then extracts the contents???
Please don't use ??? like that, it makes you sound like you're shouting.

And no. You first have to copy the 7z to the harddrive using the File command (it's actually called extracting, not copying, because you need to extract it from the installer exe.) Or you can use a 7z file from a CD, or a downloaded one, of course.

thanks MSG and sorry for "???" :)

I have some files in 7z format file, so my project takes about 8GB...so i need a plugin that allow me to extract these files from fixed media, like DVD...

If i use de 7z standalone file for use command line, this work for me but progress bar not moving and not showing the information progress like "10% - file.xx".


Indeed, the standalone 7z is not designed for NSIS, so it will not output information to the NSIS log by itself. You can try using nsExec::ExecToLog, but if I recall correctly it doesn't work here because 7z doesn't just print information, it updates it as well (like the percentage counter). And that doesn't work with ExecToLog, as far as I know.

But have you tried the 7z plugin? It should be able to unpack a 7z archive just fine.


Hi ...

Yes MSG, worked fine if i use 7za.exe...