# 7Zip

## Recommended Posts

Use Fileinstall() or try this execellent post Embed DLLs in script and call functions from memory by Ward...

I've tried FileInstall with no luck. I know for a fact it is incorporating the .dll into the exe as the file size increases according to how much the .dll is.

I took a look at the loading the dll into memory but i'm not sure on how to get this into the script. Do i use this method to insert into my main script or does this go into the 7zip.au3 include file. Sorry to be a pain but i'm still learning.

• Replies 151
• Created

#### Popular Posts

Hi everyone! Ok, after searching for any solution about works with 7Zip archives I found this interesting topic with several examples. And within several days I have written this UDF Main features:

I just check all files which was available here, collect them and post them to this download link/section:   REMARK / WARNING: Some of them are little refactored. Each have add links to

I took a look at the loading the dll into memory but i'm not sure on how to get this into the script.

Thats a method for advanced users... I think I would get it to work, but don't ask my about the details being done there ...

FileInstall() is the way to go for you. Start simple. Put the 7-zip32.dll file in the same directory as your source-script and then add this line somewhere at the top of the script, before you try to open the dll:

FileInstall("7-zip32.dll", @ScriptDir & "\7-zip32.dll")

afterwards open it with

Global $hDLL_7ZIP = DllOpen(@Scriptdir & "\7-zip32.dll") Then compile the exe, the dll is included and will be copied to @scriptdir (same dir as the exe) if it does not exist. Note for Fileinstall, the source may NOT contain a variable, the target may (like @ScriptDir). ##### Link to post ##### Share on other sites • 1 month later... Thanks For share ) ##### Link to post ##### Share on other sites • 5 months later... Need some help I want to add files to a new archive, but place them in separate directories. ZIP/dir_inside_zip/my_file I can only add files into the root directory (ZIP/my_file) This is how i tried it: _7ZIPADD(0, "data\" & ($biggest_commit + 1) & ".zip", "..\"&$FileList[$i], 0, 9, 1)

$FileList[$i] is "some_dir\another_dir\file.txt"

It adds the file to the archive successfully, but drops all the folders and place it into the root of the zip

Thanks

Edited by Lazarushun
##### Share on other sites

nvm, figured out i gotta point into directories to store directories

##### Share on other sites
• 1 month later...

Downloaded the '7zip_udf.zip' file posted here, extracted and found two internet shortcuts.

Opened the '7zip_udf' shortcut only to be shown:

Forbidden

You don't have permission to access /archives/7zip_udf.zip on this server.

Next, I opened the second shortcut, '7zip_udf_mirror' and was presented with:

Any chance that someone here can either tell me what secret dance is needed to make those work or perhaps a working download of this au3 file?

It would be very much appreciated.

##### Share on other sites

I have the UDF in my archives Here it is:

7Zip_UDF.zip

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

##### Share on other sites

Thank you very much, ProgAndy.

Double thumbs up for attaching and the rather fast response. You're a life saver

##### Share on other sites
• 4 weeks later...

anyone have this?

##### Share on other sites
• 5 months later...

I am getting an error while using _7ZIPExtractEx to extract a tar archive. Is this normal?

My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]

##### Share on other sites
• 3 months later...

Anyone have an idea on how to make SFX archive?

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

My Work...

Spoiler

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating )

* === My topics === *

==================================================

==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

##### Share on other sites

It depends on what type of SFX archive you want to make. 7-zip has options for making a GUI SFX, a command line SFX, a software installer GUI SFX, and a software installer command line SFX. The GUI and the command line SFX modules are included with the 7-zip package, and the software installer SFX mondules are included in the 7-Zip Extra.

If you want to make the GUI SFX archive, have the SFX file and the 7z archive in the same directory as the script. The command is quite simple.

Run('copy /b 7z.sfx + archive.7z archive.exe', '', @SW_HIDE)

For the command line:

Run('copy /b 7zCon.sfx + archive.7z archive.exe', '', @SW_HIDE)

##### Share on other sites

But we are talking about 7-zip32.dll here (the udf), so is there any working examples for it?

I have tried like this:

_7ZipAdd(0, @ScriptDir & "\Archive.exe", @ScriptFullPath, 0, 5, 0, 0, 0, 0, "C:\Program Files\7-Zip\7z.sfx")

But the executable does not created .

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

My Work...

Spoiler

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating )

* === My topics === *

==================================================

==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

##### Share on other sites

And i am need to create quit executable, that will extract all files to the current folder without prompt, and replace any existing files.

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

My Work...

Spoiler

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating )

* === My topics === *

==================================================

==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

##### Share on other sites
• 1 month later...

Why does not specify the compression method using a file extension and compresses the archive 7z

#include <7Zip.au3>
; If FileExists(@ScriptDir & '\TMP') Then DirRemove(@ScriptDir & '\TMP', 1)
_7ZIPExtractEx(0, @ScriptDir&'\test.docx', @ScriptDir&'\TMP',1 , 1)
_7ZipAdd(0, @ScriptDir & "\template_New.zip", @ScriptDir & "\TMP\", 1, 1)
FileMove(@ScriptDir & "\template_New.zip", @ScriptDir&'\test_New.docx', 9)
##### Share on other sites

I have tried like this:

_7ZipAdd(0, @ScriptDir & "\Archive.exe", @ScriptFullPath, 0, 5, 0, 0, 0, 0, "C:\Program Files\7-Zip\7z.sfx")

_7ZipAdd(0, @ScriptDir & "\Archive.exe", @ScriptFullPath, 0, 5, 0, 0, 0, 0, FileGetShortNAme("C:\Program Files\7-Zip\7z.sfx"))
##### Share on other sites
• 2 weeks later...

Since rasim appears to be gone and he never addressed the issue of using OnAutoItExit in his UDF I took the liberty of rewriting all the functions and adding two of my own, _7ZipStartup() and _7ZipShutdown().

If you use the edited version of the script note that it works slightly different now. The first parameter in each function is now a dll handle followed by the rest of the original parameters.

So it all looks a bit like this.

$7zip = _7ZipStartup()$extract = _7ZIPExtractEx($7zip,0,"archive.zip","C:\path\to\extraction\folder\",1) _7ZipShutdown($7zip)

[size="1"]Please stop confusing "how to" with "how do"[/size]

##### Share on other sites
• 4 months later...

Has anyone attempted to use the brand new AutoIt 3.3.8 with standard 7za.dll?

If not then, would someone else mind maintaining this, rasim seesm to have lost interest...

Edited by money
##### Share on other sites
• 4 months later...

This work is really interesting.

I want to try this out but the URLs in the download-archive are not really working.

TIA

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...