Jump to content

7Zip


rasim
 Share

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.

Link to comment
Share on other sites

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 comment
Share on other sites

  • 1 month later...
  • 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
Link to comment
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:

Resource not found

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.

Link to comment
Share on other sites

I have the UDF in my archives :blink: 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

Link to comment
Share on other sites

  • 4 weeks later...
  • 5 months later...
  • 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

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

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

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I have code to create it using 7za.exe if you want it?

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
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)

Adam

Link to comment
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 :huh2:.

 

Spoiler

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

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

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

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
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

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

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

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
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)
Link to comment
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"))
Link to comment
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)

7Zip.au3

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

Link to comment
Share on other sites

  • 4 months later...
  • 4 months later...

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...