flyingboz Posted September 18, 2007 Share Posted September 18, 2007 This is a real show-stopper, I hope a bug-fix/workaround will be released.If you want someone to take a look at it, then you need to post it with abject humility and after extensive testing as a potential bug w/ appropriate description / sample code / zip file containing relevant third party info instead of just whining about it in the example script forum.Of course, you could also get off your butt and code your own instead of waiting for someone to do it for you. If either of the above options are too difficult, you could grab one of the many other implementations of compression / encryption engines.... Reading the help file before you post... Not only will it make you look smarter, it will make you smarter. Link to comment Share on other sites More sharing options...
hazard_abio Posted October 22, 2007 Share Posted October 22, 2007 I've been using this UDF, and it is working without an error message, but It only 7zips up 1 file per run, and then exits. I'm going to downgrade to 3.2.0.0 to see if that will fix this. Here is my code, just in case you are wondering. expandcollapse popup#Include <File.au3> ; Including 7-zip Functions #Include "SevenZip.au3" $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $folderpath = "C:\Temp" ;$FileName = FileOpenDialog("Choose a File", "C:\", "All (*.*)") $FileName = "C:\Temp\WindowsInstaller-KB893803-v2-x86.exe" Dim $szDrive, $szDir, $szFName, $szExt, $i=1 $TsplitPath = _PathSplit($FileName, $szDrive, $szDir, $szFName, $szExt);split filename and extension $Result = _SevenZipAdd('"' & $folderpath & '\' & $szFName & '.7z"', '"' & $FileName & '"', 9, "7z") $FileName = "C:\Temp\WindowsUpdateAgent20-x86.exe" $Result = _SevenZipAdd('"' & $folderpath & '\' & $szFName & '.7z"', '"' & $FileName & '"', 9, "7z") ; This COM error Handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc Exit Link to comment Share on other sites More sharing options...
DirtDBaK Posted October 22, 2007 Share Posted October 22, 2007 This seems like a nice addition to AutoIT I'll have to try it out sometime... good work [center][/center] Link to comment Share on other sites More sharing options...
Tlem Posted October 20, 2008 Share Posted October 20, 2008 (edited) This is the updated code (I try it and it work). Hope that the use of DllCall is right. I have made a little modification, to indicate the path of the 7-zip32.dll (ScriptDir by default) If someone know the way to hide the compression/decompression windows it will be very nice. expandcollapse popup#cs ------------------------------------------ Functions for use with 7-zip32.dll Version 0.4.2 Updated by Tlem Copyright (C) 2006 JAK-Software.org. Released under GNU LGPL. Please Note: To use the functions, the 7-zip32.dll file must be in the scriptDir or you must set the path where 7-zip32.dll is installed. Changes: 0.4.2: - Updated to work with AutoIt 3.2.12.0 - Made correction for use full path of files. - Added parameter to indicate the path of 7-zip32.dll (ScriptDir by default). - Deleted Hwnd Argument 0.4.1: - Replaced last parameter: "str", 0 ==> "int", 0 0.4: - Added Hwnd Argument - Modified Variable Names - Added SetError(1) and Return 0 for Errors 0.3: - Removed @ScriptDir in DllOpen ------------------------------------------ #ce ;=============================================================================== ; ; Description: Adds Files to an Archive/Creates an Archiv ; Parameter(s): $Dll - The path of 7-zip32.dll (ScriptDir by default) ; $sArchive - The Archive to use ; $sOutDir - Where to extract the files ; $sFilter - Files to extract from the Archive (e.g. *.exe) ; $sCMDLine - Optional Options ; Requirement(s): None ; Return Value(s): On Success - Return 1 ; On Failure - Return 0 ; Author(s): JAK-Software.org ; Note(s): Relative path of files doesn't work. ; ;=============================================================================== Func _SevenZipAdd($Dll, $sArchive, $sFiles, $iLevel = 6, $sType = "7z", $sCMDLine = "") If $Dll = "" Then $Dll = "7-zip32.dll" $Dll = DllOpen($Dll) $result = DllCall($dll, "int", "SevenZip", "hwnd", 0, "str", 'a "' & $sCMDLine & '" -mx' & $iLevel & ' -t' & $sType & ' "' & $sArchive & '" "' & $sFiles & '"', "str", "SevenZip", "int", 0) $error = @error DllClose($Dll) If $error Then Return 0 Else Return 1 EndIf EndFunc ;==>_SevenZipAdd ;=============================================================================== ; ; Description: Executes 7-zip Commands (Syntax Like in 7z.exe/7za.exe) ; Parameter(s): $Dll - The path of 7-zip32.dll (ScriptDir by default) ; $sCMDLine - The Commandline ; Requirement(s): None ; Return Value(s): On Success - Return 1 ; On Failure - Return 0 ; Author(s): JAK-Software.org ; Note(s): ; ;=============================================================================== Func _SevenZipCMD($Dll, $sCMDLine) If $Dll = "" Then $Dll = "7-zip32.dll" $Dll = DllOpen($Dll) DllCall($Dll, "int", "SevenZip", "hwnd", 0, "str", $sCMDLine, "str", "SevenZip", "int", 0) $error = @error DllClose($Dll) If $error Then Return 0 Else Return 1 EndIf EndFunc ;==>_SevenZipCMD ;=============================================================================== ; ; Description: Extracts files from an archive ; Parameter(s): $Dll - The path of 7-zip32.dll (ScriptDir by default) ; $sArchive - The Archive to use ; $sOutDir - Where to extract the files ; $sFilter - Files to extract from the Archive (e.g. *.exe) ; $sCMDLine - Optional Options ; Requirement(s): None ; Return Value(s): On Success - Return 1 ; On Failure - Return 0 ; Author(s): JAK-Software.org ; Note(s): ; ;=============================================================================== Func _SevenZipExtract($Dll, $sArchive, $sOutDir = ".", $sFilter = '*', $sCMDLine = '') If $Dll = "" Then $Dll = "7-zip32.dll" $Dll = DllOpen($Dll) DllCall($Dll, "int", "SevenZip", "hwnd", 0, "str", 'x "' & $sCMDLine & '" -o"' & $sOutDir & '" "' & $sArchive & '" ' & $sFilter, "str", "SevenZip", "int", 0) $error = @error DllClose($Dll) If $error Then Return 0 Else Return 1 EndIf EndFunc ;==>_SevenZipExtract Edited October 20, 2008 by Tlem Best Regards.Thierry Link to comment Share on other sites More sharing options...
tip Posted October 22, 2008 Share Posted October 22, 2008 This is great... But how can I make a progress bar with this one? [center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center] Link to comment Share on other sites More sharing options...
Tlem Posted October 22, 2008 Share Posted October 22, 2008 Why to make one, because it there in already one! Best Regards.Thierry Link to comment Share on other sites More sharing options...
tip Posted October 22, 2008 Share Posted October 22, 2008 ok now I have tow questions... 1) How can I read the progress to make a "progress tooltip" (a yellow box with percentage information in it) 2) Why isn't it working with 7z.dll from 7zip.org but works only 7-zip.dll? What is the difference between these two dlls??? [center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center] Link to comment Share on other sites More sharing options...
tip Posted October 22, 2008 Share Posted October 22, 2008 I would like to withdraw my second question but for some reason I can't edit my previous post. So I'm sorry about it... I've done some research and found that 7-zip.dll is specially compiled dll of a Japanese project called Common Archiver Project... And actually it's good... It's smaller in size, it works etc... Although I'd prefer to use original dll. Is there a way to do that? [center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center] Link to comment Share on other sites More sharing options...
Tlem Posted October 23, 2008 Share Posted October 23, 2008 (edited) How can I read the progress to make a "progress tooltip"I don't know.Why isn't it working with 7z.dll from 7zip.org but works only 7-zip.dllProbably because of internal name of the functions.If jak came here he will probably answer to you.Also, you can use 7za.exe that have the same size that the DLL version (approximatively) and use it by calling the run or runwait command. Take a look here : http://www.autoitscript.fr/forum/viewtopic...=381&p=2315 Edited October 23, 2008 by Tlem Best Regards.Thierry Link to comment Share on other sites More sharing options...
tip Posted October 23, 2008 Share Posted October 23, 2008 Thank you but in my current application I already use 7za.exe and I now prefer to use dll as a resource and combine my application in just 1 file ... If anyone knows syntax for original 7z.dll please help me out... Plus if I can use original dll I will be also able to use 64 bit version of 7z.dll ... [center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center] Link to comment Share on other sites More sharing options...
BrettF Posted October 23, 2008 Share Posted October 23, 2008 Why can't you use the DLL in the first post Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
tip Posted October 23, 2008 Share Posted October 23, 2008 Actually according to "dll exporter" 7zip-32.dll is much better than the original dll at level of functions but anyways the reasons why I want to use original dlls:1) To regularly check updates. I don't know how often this japanese group updates their dll...2) To be able to use 64bit version of 7z.dll3) Maybe its a little paranoiac but I don't know if they did or not add/implented some stuff in their dll...By now I've check original dll and 7zip-32.dll with "Dll Exporter". Here is the functions list for these to:7zip-32.dllexpandcollapse popupFunction Name Address Relative Address Ordinal SevenZip 0x10002a39 0x00002a39 1 (0x1) SevenZipCheckArchive 0x10002d82 0x00002d82 12 (0xc) SevenZipClearOwnerWindow 0x100034c5 0x000034c5 91 (0x5b) SevenZipCloseArchive 0x10002fa0 0x00002fa0 22 (0x16) SevenZipConfigDialog 0x10002d47 0x00002d47 11 (0xb) SevenZipFindFirst 0x10002fbf 0x00002fbf 23 (0x17) SevenZipFindNext 0x1000301b 0x0000301b 24 (0x18) SevenZipGetArcAccessTimeEx 0x100033fc 0x000033fc 69 (0x45) SevenZipGetArcCompressedSize 0x100030d2 0x000030d2 34 (0x22) SevenZipGetArcCompressedSizeEx 0x10003468 0x00003468 105 (0x69) SevenZipGetArcCreateTimeEx 0x100033e1 0x000033e1 68 (0x44) SevenZipGetArcDate 0x10003151 0x00003151 36 (0x24) SevenZipGetArcFileName 0x1000303d 0x0000303d 31 (0x1f) SevenZipGetArcFileSize 0x10003087 0x00003087 32 (0x20) SevenZipGetArcFileSizeEx 0x10003432 0x00003432 103 (0x67) SevenZipGetArchiveType 0x1000350b 0x0000350b 13 (0xd) SevenZipGetArcOriginalSize 0x100030ae 0x000030ae 33 (0x21) SevenZipGetArcOriginalSizeEx 0x1000344d 0x0000344d 104 (0x68) SevenZipGetArcOSType 0x1000318b 0x0000318b 38 (0x26) SevenZipGetArcRatio 0x10003101 0x00003101 35 (0x23) SevenZipGetArcTime 0x1000316e 0x0000316e 37 (0x25) SevenZipGetArcWriteTimeEx 0x10003417 0x00003417 70 (0x46) SevenZipGetAttribute 0x100032d4 0x000032d4 47 (0x2f) SevenZipGetBackGroundMode 0x10002d0f 0x00002d0f 5 (0x5) SevenZipGetCompressedSize 0x1000322d 0x0000322d 42 (0x2a) SevenZipGetCompressedSizeEx 0x1000349e 0x0000349e 107 (0x6b) SevenZipGetCRC 0x100032b3 0x000032b3 46 (0x2e) SevenZipGetCursorInterval 0x10002d24 0x00002d24 7 (0x7) SevenZipGetCursorMode 0x10002cfa 0x00002cfa 3 (0x3) SevenZipGetDate 0x10003279 0x00003279 44 (0x2c) SevenZipGetFileCount 0x10002e32 0x00002e32 17 (0x11) SevenZipGetFileName 0x1000319e 0x0000319e 40 (0x28) SevenZipGetMethod 0x10003322 0x00003322 61 (0x3d) SevenZipGetOriginalSize 0x100031fe 0x000031fe 41 (0x29) SevenZipGetOriginalSizeEx 0x10003483 0x00003483 106 (0x6a) SevenZipGetOSType 0x100032ff 0x000032ff 48 (0x30) SevenZipGetRatio 0x1000325c 0x0000325c 43 (0x2b) SevenZipGetRunning 0x10002d3b 0x00002d3b 10 (0xa) SevenZipGetSubVersion 0x10003506 0x00003506 94 (0x5e) SevenZipGetTime 0x10003296 0x00003296 45 (0x2d) SevenZipGetVersion 0x10002cf5 0x00002cf5 2 (0x2) SevenZipGetWriteTime 0x100033aa 0x000033aa 62 (0x3e) SevenZipGetWriteTimeEx 0x100033c6 0x000033c6 65 (0x41) SevenZipIsSFXFile 0x1000318b 0x0000318b 39 (0x27) SevenZipKillOwnerWindowEx 0x100034da 0x000034da 93 (0x5d) SevenZipKillOwnerWindowEx64 0x100034fa 0x000034fa 109 (0x6d) SevenZipOpenArchive 0x10002ece 0x00002ece 21 (0x15) SevenZipQueryFunctionList 0x10002e62 0x00002e62 18 (0x12) SevenZipSetBackGroundMode 0x10002d15 0x00002d15 6 (0x6) SevenZipSetCursorInterval 0x10002d2b 0x00002d2b 8 (0x8) SevenZipSetCursorMode 0x10002d00 0x00002d00 4 (0x4) SevenZipSetOwnerWindow 0x100034b9 0x000034b9 90 (0x5a) SevenZipSetOwnerWindowEx 0x100034ca 0x000034ca 92 (0x5c) SevenZipSetOwnerWindowEx64 0x100034e6 0x000034e6 108 (0x6c) SevenZipSetUnicodeMode 0x100035c5 0x000035c5 200 (0xc8)7z.dll 32bitFunction Name Address Relative Address Ordinal CreateObject 0x10005584 0x00005584 1 (0x1) GetHandlerProperty 0x1000550b 0x0000550b 3 (0x3) GetHandlerProperty2 0x10005430 0x00005430 2 (0x2) GetMethodProperty 0x10041f73 0x00041f73 4 (0x4) GetNumberOfFormats 0x1000551d 0x0000551d 5 (0x5) GetNumberOfMethods 0x1004205e 0x0004205e 6 (0x6) SetLargePageMode 0x100055ea 0x000055ea 7 (0x7)As you can see they do not even look like...I don't know anything about how to call dll functions correctly and -needles to say- about adress, relative address, ordinal..CAn anyone push me in to right direction...Thanks [center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center] Link to comment Share on other sites More sharing options...
engine Posted October 24, 2008 Share Posted October 24, 2008 @ tipYou can call a function in a dll by its function name or ordinal.For example:DllCall("7zip-32.dll", "return type", "SevenZip", [, "type1", param1 [, "type n", param n]] )oÝ÷ Øêí¡Æ¥Ø^±©~éܶ*'o(ßÛ(اjV®¶sdFÆÄ6ÆÂgV÷C³w¦Ó3"æFÆÂgV÷C²ÂgV÷C·&WGW&âGRgV÷C²Â²ÂgV÷C·GSgV÷C²Â&Ó²ÂgV÷C·GRâgV÷C²Â&ÒåÕÒYou need the function's documentation to know it's return type, types and parameters.Also do a search for "DllCall" on AutoIt's Help. Read it carefully.Taking a look to some examples might help you too.Regards. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
Tlem Posted October 24, 2008 Share Posted October 24, 2008 Still don't know how to use it, but it can help : http://news.xb2.net/ot4xb.public/22/Support-for-7z.htmlI have made lot of research and try many possibilities in code but it doesn't want to work.English is not my language and I'm not familiar with the DllCall ...So wait after somebody brighter that I on the subject (perhaps a super guy will help us) ...Sorry that I can't do more. Best Regards.Thierry Link to comment Share on other sites More sharing options...
engine Posted October 24, 2008 Share Posted October 24, 2008 I found the documentation here -> http://www.csdinc.co.jp/archiver/lib/7-zip32api-en.txt For example, considering SevenZipCheckArchive: ----------------------------------------------------------------------- BOOL WINAPI SevenZipCheckArchive(LPCSTR _szFileName, const int _iMode) ----------------------------------------------------------------------- The number of orders 12 Function As the archive file which the designated file supports It returns whether or not it is correct. Argument _szFileName File name of the archive file which it should check. _iMode At present time you ignore. Appointing 0. Return value TRUE At the time of correct archive file. FALSE When the file is illegitimate. in AutoIt it would be something like: Func _SevenZipCheckArchive($szFileName) Local $aSZCA = DllCall("7-zip32.dll", "int", "SevenZipCheckArchive", "str", $szFileName, "int", 0) Return SetError(@error, 0, $aSZCA[0]) EndFunc Returns 1 if the file is OK, 0 otherwise. My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
Tlem Posted October 25, 2008 Share Posted October 25, 2008 (edited) @engine We know how to use 7-zip32.dll. It's just that 'tip' (and me) want tu use the 7z.dll or 7za.dll from SenvenZip utilities. Edited October 25, 2008 by Tlem Best Regards.Thierry Link to comment Share on other sites More sharing options...
engine Posted October 25, 2008 Share Posted October 25, 2008 Sorry. The use is identical. But, you always need some kind of documentation, to point you in the right direction. I guess you don't have this documentation, right? My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url] Link to comment Share on other sites More sharing options...
Tlem Posted October 29, 2008 Share Posted October 29, 2008 Of course that right. And it's why tip ask help. 7-zip32.dll is smoller than 7z.dll so that doesn't mater for me ...But for my knowledge, I will be happy to know how to do it with 7z.dll. Best Regards.Thierry Link to comment Share on other sites More sharing options...
Tlem Posted November 15, 2008 Share Posted November 15, 2008 (edited) I have updated the code of the function made by JAK. This time all is OK (relative path and problem sometime on compression). expandcollapse popup#cs ------------------------------------------ Functions for use with 7-zip32.dll Version 0.4.5 Updated by Tlem Copyright (C) 2006 JAK-Software.org. Released under GNU LGPL. Please Note: To use the functions, the 7-zip32.dll file must be in the scriptDir or you must set the path where 7-zip32.dll is installed. Switch that can be used in functions (by $CMD): -p(password) exemple : -pMyPassword -v{Size}[b | k | m | g] exemple : -v1400k -sfx (SFX archive - ask for title and other) -y For assume Yes on all queries (for extract function). Changes: 0.4.5: - Updated By Tlem - Fixed error in function code (DllCall). Correction made in accordance of the 7-Zip32 API : int WINAPI SevenZip(const HWND _hwnd, LPCSTR _szCmdLine, LPSTR _szOutput, const DWORD _dwSize) - Add a _SevenZipUpDate() function. - Add an extra parameters for _SevenZipAdd() and _SevenZipUpDate() functions to set recursive or not. - Add a strip leading/trailing white space of $CMD. 0.4.4: - Updated By Tlem - Fixed error in code of return 0.4.3: - Updated By Tlem - Fixed error on DllCall parameters. - Fixed Relative path of files and Dll doesn't work. - Added control if 7-zip32.dll can be find. 0.4.2: - Updated By Tlem - Updated to work with AutoIt 3.2.12.0 - Made correction for use full path of files. - Added parameter to indicate the path of 7-zip32.dll (ScriptDir by default). - Deleted Hwnd Argument 0.4.1: - Replaced last parameter: "str", 0 ==> "int", 0 0.4: - Added Hwnd Argument - Modified Variable Names - Added SetError(1) and Return 0 for Errors 0.3: - Removed @ScriptDir in DllOpen ------------------------------------------ #ce ;=============================================================================== ; ; Description: Adds Files to an Archive/Creates an Archive ; Parameter(s): $Dll - The path of 7-zip32.dll (ScriptDir by default) ; $sArchive - The Archive to use ; $sOutDir - Where to extract the files ; $sFilter - Files to extract from the Archive (e.g. *.exe) ; $sCMDLine - Optional Options ; Requirement(s): None ; Return Value(s): On Success - Return 1 ; On Failure - Return 0 ; Author(s): JAK-Software.org (Updated By Tlem) ; Note(s): http://www.7-zip.org/download.html for switch option and cmdline help ; ;=============================================================================== Func _SevenZipAdd($Dll, $sArchive, $sFiles, $sRecurse = 0, $iLevel = 6, $sType = "7z", $sCMDLine = "") If $Dll = "" Then $Dll = "7-zip32.dll" If Not FileExists($Dll) Then Return 0 If $sRecurse = 0 Then $sRecurse = "" Else $sRecurse = "-r" EndIf $sCMDLine = StringStripWS($sCMDLine, 3) $Dll = DllOpen($Dll) $Ret = DllCall($Dll, "int", "SevenZip", "hwnd", 0, "str",'a ' & $sCMDLine & ' -mx=' & $iLevel & ' -t' & $sType & ' "' & $sArchive & '" "' & $sFiles & '" ' & $sRecurse, "str", "", "int", 65535) DllClose($Dll) If Not @error Then If $Ret[0] <> 0 Then Return 0 Else Return 1 EndIf Else Return 0 EndIf EndFunc ;==>_SevenZipAdd ;=============================================================================== ; ; Description: Update Files to an Archive/Creates an Archive ; Parameter(s): $Dll - The path of 7-zip32.dll (ScriptDir by default) ; $sArchive - The Archive to use ; $sOutDir - Where to extract the files ; $sFilter - Files to extract from the Archive (e.g. *.exe) ; $sCMDLine - Optional Options ; Requirement(s): None ; Return Value(s): On Success - Return 1 ; On Failure - Return 0 ; Author(s): JAK-Software.org (Updated By Tlem) ; Note(s): http://www.7-zip.org/download.html for switch option and cmdline help ; ;=============================================================================== Func _SevenZipUpDate($Dll, $sArchive, $sFiles, $sRecurse = 0, $iLevel = 6, $sType = "7z", $sCMDLine = "") If $Dll = "" Then $Dll = "7-zip32.dll" If Not FileExists($Dll) Then Return 0 If $sRecurse = 0 Then $sRecurse = "" Else $sRecurse = "-r" EndIf $sCMDLine = StringStripWS($sCMDLine, 3) $Dll = DllOpen($Dll) $Ret = DllCall($Dll, "int", "SevenZip", "hwnd", 0, "str", 'u ' & $sCMDLine & ' -mx=' & $iLevel & ' -t' & $sType & ' "' & $sArchive & '" "' & $sFiles & '" ' & $sRecurse, "str", "", "int", 65535) DllClose($Dll) If Not @error Then If $Ret[0] <> 0 Then Return 0 Else Return 1 EndIf Else Return 0 EndIf EndFunc ;==>_SevenZipUpDate ;=============================================================================== ; ; Description: Extracts files from an archive with full path ; Parameter(s): $Dll - The path of 7-zip32.dll (ScriptDir by default) ; $sArchive - The Archive to use ; $sOutDir - Where to extract the files ; $sFilter - Files to extract from the Archive (e.g. *.exe) ; $sCMDLine - Optional Options ; Requirement(s): None ; Return Value(s): On Success - Return 1 ; On Failure - Return 0 ; Author(s): JAK-Software.org (Updated By Tlem) ; Note(s): http://www.7-zip.org/download.html for switch option and cmdline help ; ;=============================================================================== Func _SevenZipExtract($Dll, $sArchive, $sOutDir = ".", $sFilter = '*', $sCMDLine = '') If $Dll = "" Then $Dll = "7-zip32.dll" If Not FileExists($Dll) Then Return 0 $Dll = DllOpen($Dll) $Ret = DllCall($Dll, "int", "SevenZip", "hwnd", 0, "str", 'x ' & $sCMDLine & ' -o"' & $sOutDir & '" "' & $sArchive & '" ' & $sFilter, "str", "", "int", 65535) $sCMDLine = StringStripWS($sCMDLine, 3) DllClose($Dll) If Not @error Then If $Ret[0] <> 0 Then Return 0 Else Return 1 EndIf Else Return 0 EndIf EndFunc ;==>_SevenZipExtract ;=============================================================================== ; ; Description: Executes 7-zip Commands (Syntax Like in 7z.exe/7za.exe) ; Parameter(s): $Dll - The path of 7-zip32.dll (ScriptDir by default) ; $sCMDLine - The Commandline ; Requirement(s): None ; Return Value(s): On Success - Return 1 ; On Failure - Return 0 ; Author(s): JAK-Software.org (Updated By Tlem) ; Note(s): http://www.7-zip.org/download.html for switch option and cmdline help ; ;=============================================================================== Func _SevenZipCMD($Dll, $sCMDLine) If $Dll = "" Then $Dll = "7-zip32.dll" If Not FileExists($Dll) Then Return 0 $sCMDLine = StringStripWS($sCMDLine, 3) $Dll = DllOpen($Dll) $Ret = DllCall($Dll, "int", "SevenZip", "hwnd", 0, "str", '"' & $sCMDLine & '"', "str", "", "int", 65535) DllClose($Dll) If Not @error Then If $Ret[0] <> 0 Then Return 0 Else Return 1 EndIf Else Return 0 EndIf EndFunc ;==>_SevenZipCMD Edited November 23, 2008 by Tlem Best Regards.Thierry Link to comment Share on other sites More sharing options...
Tlem Posted November 22, 2008 Share Posted November 22, 2008 (edited) Code updated to version 0.4.5. - Fixed error in function code (DllCall). Correction made in accordance of the 7-Zip32 API : int WINAPI SevenZip(const HWND _hwnd, LPCSTR _szCmdLine, LPSTR _szOutput, const DWORD _dwSize) - Add a _SevenZipUpDate() function. - Add an extra parameters for _SevenZipAdd() and _SevenZipUpDate() functions to set recursive or not Edited November 22, 2008 by Tlem Best Regards.Thierry Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now