ray306 Posted December 16, 2006 Share Posted December 16, 2006 Hi: I'm running XP Pro sp2 and autoIt v3.2.0.1 I'm trying to use the UDF _ZipFunctions.au3 By PsaltyDS I'm trying to unzip a file and put the extracted files into a folder. In tracing the UDF the problem occurs at line 195 ---$oDest.CopyHere ($oItems) It is not throwing a UDF coded error but a system error--"Error copying file or file does not exist" I have verified that indeed the file does NOT exist in the destination folder and that the array $oItems has a correct listing of the files. Also the necessary destination folder HAS been created by the script. In addition just as the error dialog comes up the progress bar comes up listing correct source and destination names Any Ideas? Ray306 Link to comment Share on other sites More sharing options...
HnAw Posted December 17, 2006 Share Posted December 17, 2006 Hi guys Is possible overwrite files on target folder ? i need to do it Link to comment Share on other sites More sharing options...
ray306 Posted December 17, 2006 Share Posted December 17, 2006 Hi:I'm running XP Pro sp2 and autoIt v3.2.0.1I'm trying to use the UDF _ZipFunctions.au3 By PsaltyDSI'm trying to unzip a file and put the extracted files into a folder.In tracing the UDF the problem occurs at line 195 ---$oDest.CopyHere ($oItems)It is not throwing a UDF coded error but a system error--"Error copying file or file does not exist"I have verified that indeed the file does NOT exist in the destination folder and that the array $oItems has a correct listing of the files.Also the necessary destination folder HAS been created by the script.In addition just as the error dialog comes up the progress bar comes up listing correct source and destination namesAny Ideas?Ray306Interesting addition to this. I'm wracking my brain trying to figure why this continues to fail. I compiled it .exe and it willrun on another machine. Go Figure???Any ideas? Link to comment Share on other sites More sharing options...
mozart90 Posted January 8, 2007 Author Share Posted January 8, 2007 Interesting addition to this. I'm wracking my brain trying to figure why this continues to fail. I compiled it .exe and it willrun on another machine. Go Figure???Any ideas?do you have the zip option (unter xp) uninstalled?So can you compress and decompress files in explorer?The zip options feature of xp has to be installed/enabled - without it can't work.greetings mozart90 Easy Zip Compression using XP Link to comment Share on other sites More sharing options...
xerxes717 Posted February 27, 2007 Share Posted February 27, 2007 (edited) Thanks for this great work guys! I have a question though: Is there way to add more than 1 file using * as a masking char with _ZipAdd? ie let's say there are 100 files like file01.txt, file02.txt, file03.txt ... file100.txt. If i set $SrcFile = "C:\ziptest\Files\file*.txt", it doesn't add any files to the zip file. Also, the same folder contains many other files (other than the text files in question) so I don't want the entire folder zipped either. Any ideas? Edited February 27, 2007 by xerxes717 Link to comment Share on other sites More sharing options...
xerxes717 Posted March 27, 2007 Share Posted March 27, 2007 Thanks for this great work guys! I have a question though: Is there way to add more than 1 file using * as a masking char with _ZipAdd? ie let's say there are 100 files like file01.txt, file02.txt, file03.txt ... file100.txt. If i set $SrcFile = "C:\ziptest\Files\file*.txt", it doesn't add any files to the zip file.Also, the same folder contains many other files (other than the text files in question) so I don't want the entire folder zipped either.Any ideas?Bump to see if anyone had any ideas. Thanks in advance! Link to comment Share on other sites More sharing options...
GEOSoft Posted March 28, 2007 Share Posted March 28, 2007 Thanks for this great work guys! I have a question though: Is there way to add more than 1 file using * as a masking char with _ZipAdd? ie let's say there are 100 files like file01.txt, file02.txt, file03.txt ... file100.txt. If i set $SrcFile = "C:\ziptest\Files\file*.txt", it doesn't add any files to the zip file. Also, the same folder contains many other files (other than the text files in question) so I don't want the entire folder zipped either. Any ideas?Try Using File find firstFile/FileFindNextFile to create an array and then feed the elements of the array to the function. $File = FileFindFirstFile("C:\ziptest\Files\file*.txt") $Flist ='' While 1 $FList &= FileFindNextFile($File) & '|' If @Error then ExitLoop Wend $Flist = StringSplit(StringTrimRight($FList, 1), '|') For $I = 1 To $FList[0] _ZipAdd(<parameters>) Next Make sure you add error handling into the FileFindFirstFile. See the help file George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Rick Posted May 4, 2007 Share Posted May 4, 2007 (edited) hi, love this script, altho i do have one question regarding the _Ziplist function: it does indeed list whats in the zip, but if it comes across a folder its size is zero. is there a way for the function to detect a folder inside a zip and recurse thru? my reasoning is because im seeking the total size of all files within a zip of their uncompressed state (item 5) so i can view a zip and find out its final extraction size b4 unzipping it. hope you guys can help Edited May 4, 2007 by Rick Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
Rick Posted May 13, 2007 Share Posted May 13, 2007 (edited) Hmm, this doesnt appear to work with v3.2.4.0 as _zipAdd repeatedly asks to have a disk inserted!? any ideas why? Edited May 13, 2007 by Rick Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
Wayada Posted May 15, 2007 Share Posted May 15, 2007 Came in search of the same answers as Rick. Has anyone had any success with this. Unfortuneatly for me this is above and beyond my talent and knowledge of AutoIt and objects. ..........is there a way for the function to detect a folder inside a zip and recurse thru?......... hope you guys can help Link to comment Share on other sites More sharing options...
Rick Posted May 16, 2007 Share Posted May 16, 2007 (edited) for those using v 3.2.4.2 to create the zip initially you'll need to use this line of code ... $init_zipString= Binary(Chr(80) & Chr(75) & Chr(5) & Chr(6) );Create the instead of... $init_zipString= Chr(80) & Chr(75) & Chr(5) & Chr(6) ;Create the Header in... Func InitZip ($zip_path_name) * $init_zipString= Chr(80) & Chr(75) & Chr(5) & Chr(6) ;Create the Header String for $n =1 to 18;the $init_zipString= $init_zipString & Chr(0);Header next $file =FileOpen($zip_path_name,2) FileWrite($file,$init_zipString);Write the string in a file FileClose($file) EndFunc altho i just use the following in the _ZipAdd function FileDelete($sZip) $init= Binary(Chr(80) & Chr(75) & Chr(5) & Chr(6)) for $n =1 to 18 $init &= chr(0) next FileWrite($sZip,$init) Edited May 16, 2007 by Rick Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
Ram Posted January 24, 2008 Share Posted January 24, 2008 This doesn't work right on the new version? any idea on working the same with the new version? Link to comment Share on other sites More sharing options...
DarkMatter Posted April 2, 2008 Share Posted April 2, 2008 First off good job i was aware about this in .net but i would of never of thought to put in autoit cause i couldnt think it could be done by creating the dummy.zip without doing a byte array. So thank you showing me how to create the dummy file. The script i made uses more shell objects to create browsers to search for the files and folder as seen below i documented best i can put the microsoft links for the objects am using. Only reason i wrote this was show a different way of doing what you did. Basically you got a choice either enter path by using a Input box hit cancel then a browser will pop and you can pick your zip if you want to create one then you will enter the inputbox the path and name of the zip then it will create it. expandcollapse popupDim $Shell,$srcFolder,$DestFolder,$items;Objects Const $BIF_BROWSEINCLUDEFILES = 0x4000 Const $ssfPERSONAL = 0x5;My Documents directory $Shell = ObjCreate("Shell.Application") ;$Destfolder = "C:\Backups\tmp.zmp" ;will copy the directory myscripts and everything in it ;if you do c:\myscripts\ then it just copies the directory contents and not myscripts directory ;$srcFolder = "C:\myscripts" $answer = InputBox("Create zip File",'Enter Name of file and path (example."c:\myzip.zip") otherwise hit cancel to browse for zip',"") If @error = 1 then $DestFolder = $shell.browseforfolder(0,"Pick Destination Folder or Zip",$BIF_BROWSEINCLUDEFILES) Else initzip($answer) $Destfolder = $answer EndIF ;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/shell/browseforfolder.asp ;also you can define a default path for the brosweforfolder to open as fourth parameter as so below example ;$DestFolder = $shell.browseforfolder(0,"Pick Destination Folder or Zip",$BIF_BROWSEINCLUDEFILES,$ssfPERSONAL) $srcFolder = $shell.browseforfolder(0,"Pick Source Folder or File",$BIF_BROWSEINCLUDEFILES) ;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/folder/copyhere.asp $Shell.NameSpace($DestFolder).Copyhere ($srcFolder,0) ; DO NOT REMOVE IT NEEDS IT BECAUSE WHEN TRYING TO MOVE FILES TO A ZIP IT CREATES _ ;A NEW PROCESS IF SCRIPTS FINISHES BEFORE COPING STARTS YOU GET A EMPTY ZIP FILE!!!! sleep(5000) Func InitZip ($zip_path_name) If NOT FileExists($zip_Path_name) then $init_zipString= Chr(80) & Chr(75) & Chr(5) & Chr(6);Create the Header String for $n =1 to 18 ;the $init_zipString= $init_zipString & Chr(0);Header next $file =FileOpen($zip_path_name,2) FileWrite($file,$init_zipString) ;Write the string in a file FileClose($file) EndIf EndFunc It just a quick way of creating a zip then adding content to it and i didnt want to waste alot of time creating gui interface for doing the browser so i used was already availably to me not alot of people are aware of browser so this was a perfect example hopefully people can find a use for it. Once again thanks for sharing your findings. A side note to this, I was working on creating some zip functions in v3.2.10.0 In order for this to work correctly in this version $file =FileOpen($zip_path_name,2) Needs to be changed to: $file =FileOpen($zip_path_name,2) [sub]Quantum mechanics: The dreams stuff is made of[/sub] Link to comment Share on other sites More sharing options...
DarkMatter Posted April 2, 2008 Share Posted April 2, 2008 First off good job i was aware about this in .net but i would of never of thought to put in autoit cause i couldnt think it could be done by creating the dummy.zip without doing a byte array. So thank you showing me how to create the dummy file. The script i made uses more shell objects to create browsers to search for the files and folder as seen below i documented best i can put the microsoft links for the objects am using. Only reason i wrote this was show a different way of doing what you did. Basically you got a choice either enter path by using a Input box hit cancel then a browser will pop and you can pick your zip if you want to create one then you will enter the inputbox the path and name of the zip then it will create it. expandcollapse popupDim $Shell,$srcFolder,$DestFolder,$items;Objects Const $BIF_BROWSEINCLUDEFILES = 0x4000 Const $ssfPERSONAL = 0x5;My Documents directory $Shell = ObjCreate("Shell.Application") ;$Destfolder = "C:\Backups\tmp.zmp" ;will copy the directory myscripts and everything in it ;if you do c:\myscripts\ then it just copies the directory contents and not myscripts directory ;$srcFolder = "C:\myscripts" $answer = InputBox("Create zip File",'Enter Name of file and path (example."c:\myzip.zip") otherwise hit cancel to browse for zip',"") If @error = 1 then $DestFolder = $shell.browseforfolder(0,"Pick Destination Folder or Zip",$BIF_BROWSEINCLUDEFILES) Else initzip($answer) $Destfolder = $answer EndIF ;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/shell/browseforfolder.asp ;also you can define a default path for the brosweforfolder to open as fourth parameter as so below example ;$DestFolder = $shell.browseforfolder(0,"Pick Destination Folder or Zip",$BIF_BROWSEINCLUDEFILES,$ssfPERSONAL) $srcFolder = $shell.browseforfolder(0,"Pick Source Folder or File",$BIF_BROWSEINCLUDEFILES) ;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/folder/copyhere.asp $Shell.NameSpace($DestFolder).Copyhere ($srcFolder,0) ; DO NOT REMOVE IT NEEDS IT BECAUSE WHEN TRYING TO MOVE FILES TO A ZIP IT CREATES _ ;A NEW PROCESS IF SCRIPTS FINISHES BEFORE COPING STARTS YOU GET A EMPTY ZIP FILE!!!! sleep(5000) Func InitZip ($zip_path_name) If NOT FileExists($zip_Path_name) then $init_zipString= Chr(80) & Chr(75) & Chr(5) & Chr(6);Create the Header String for $n =1 to 18 ;the $init_zipString= $init_zipString & Chr(0);Header next $file =FileOpen($zip_path_name,2) FileWrite($file,$init_zipString) ;Write the string in a file FileClose($file) EndIf EndFunc It just a quick way of creating a zip then adding content to it and i didnt want to waste alot of time creating gui interface for doing the browser so i used was already availably to me not alot of people are aware of browser so this was a perfect example hopefully people can find a use for it. Once again thanks for sharing your findings. I know this topic is dead, but a side note to this is in V3.2.10.0 in order for this to work $file =FileOpen($zip_path_name,2) needs to be changed to: $file =FileOpen($zip_path_name,18) [sub]Quantum mechanics: The dreams stuff is made of[/sub] Link to comment Share on other sites More sharing options...
Dickb Posted April 2, 2008 Share Posted April 2, 2008 Working example: $sZip = "TestFile.zip" $hFile = FileOpen($sZip, 18) $init= Chr(80) & Chr(75) & Chr(5) & Chr(6) for $n =1 to 18 $init &= chr(0) next FileWrite($hFile, $init) FileClose($hFile) Link to comment Share on other sites More sharing options...
MrCreatoR Posted April 4, 2008 Share Posted April 4, 2008 Why user can get this message on Vista (Ultimate, SP1) :?The error is from the line where items collected («$oItems = $oFolder.Items()»).But there is another (Unknown) error, that triggered on «$oFolder = $oShell.NameSpace($sZip)», so my guess is that the «Shell.Application» object does not created...Can any one test it please? (ho have Vista of course ).  Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1  AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ==================================================    AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
TheSaint Posted April 9, 2008 Share Posted April 9, 2008 Hi All Has anyone found a way of using password features for zips ... obviously I'm asking in relation to this post ... not 7zip or any other program or non default Windows dll? Also, the Unzip routine here doesn't like it when you rename the .zip extension and then try to unzip ... does anyone know a work-a-round for this ... other than rename rename? Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
smooter Posted April 17, 2008 Share Posted April 17, 2008 I know that this topic is supposed to be dead, but is there any plans to update the _ZipFunctions to support 2003 Server, and above? As usual, I didn't read the whole topic, and troubleshot the heck out of this thing before I realized that it only works on XP! Duh! I will read better next time...(probably won't, but it is nice to think so!) Thanks, smooter Link to comment Share on other sites More sharing options...
TheSaint Posted November 18, 2008 Share Posted November 18, 2008 Once again, THANKS guys! Some of my programs use these - four are mentioned here, two only are currently available they are Installer Creator and Create Zip Within v1.0. Web Unzipper + Web Zipper are not fully tested/finished. I had to compile with AutoIt v3.2.0.1 for those that need to know. Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
TheSaint Posted December 14, 2008 Share Posted December 14, 2008 (edited) Thanks again guys, my Universal Installer uses a modified version of _ZipFunctions.au3. I just incorporated most of the elements from this topic. It seems to work fine for me now in AutoIt v3.2.4.9. Here it is, features livewire's addon to extract a single file (someone might like to incorporate the folder element he also supplied above) -CODE#include-once;======================================; _ZipFunctions.au3 -- v1.0 -- 20 June, 2006; An AutoIT User Defined Function (UDF) file.;; Requires AutoIT 3.1.127 or later.; Uses the native compression API of Windows XP, Windows 2003, or later.;; By PsaltyDS at http://www.autoitscript.com/forum; Includes code from other forum users, especially as posted at:; http://www.autoitscript.com/forum/index.php?showtopic=21004;; Includes the following functions:; _ZipCreate($sZip, $iFlag = 0); _ZipAdd($sZip, $sSrc); _ZipList($sZip); _UnZip($sZip, $sDest); See each function below for full usage.;======================================;----------------------------------; Function _ZipCreate($sZip, $iFlag = 0); Creates an empty .zip archive file.; Where:; $sZip is the .zip file to create; $iFlag: 0 = prompts to overwrite (default); 1 = overwrite without prompt; Returns 1 on success, 0 for fail; On fail, @Error is:; 1 = Not permitted to overwrite; 2 = FileOpen failed; 3 = FileWrite failed;----------------------------------Func _ZipCreate($sZip, $iFlag = 0); Test zip file If FileExists($sZip) Then If Not $iFlag Then If MsgBox(262144 + 32 + 4, "Zip Functions UDF", "Click YES to overwrite existing archive file: " & @CRLF & _ @TAB & $sZip) <> 6 Then Return SetError(1, 0, 0) EndIf EndIf; Create header data Local $sHeader = Chr(80) & Chr(75) & Chr(5) & Chr(6) For $i = 1 To 18 $sHeader &= Chr(0) Next; Create empty zip file $hFile = FileOpen($sZip, 16 + 8 + 2); Mode = Binary, Create folder, Overwrite If $hFile <> - 1 Then If FileWrite($hFile, $sHeader) Then FileClose($hFile) Return 1 Else Return SetError(3, 0, 0) EndIf Else Return SetError(2, 0, 0) EndIfEndFunc ;==>_ZipCreate;----------------------------------; Function _ZipAdd($sZip, $sSrc); Adds a file or folder to a pre-existing .zip archive.; Where:; $sZip is the .zip file to add to; $sSrc is the source file or folder to add; Returns 1 on success, 0 for fail; On fail, @Error is:; 1 = Creating Zip file failed [@Extended = @Error from _ZipCreate()]; 2 = Source did not exist; 3 = Shell ObjCreate error; 4 = Zip file namespace object error; 5 = Error copying data;----------------------------------Func _ZipAdd($sZip, $sSrc); Test zip file and create if required If Not FileExists($sZip) Then If Not _ZipCreate($sZip) Then Return SetError(1, @error, 0) EndIf; Test source If FileExists($sSrc) Then ; Create shell object Local $oShell = ObjCreate('Shell.Application') If Not @error And IsObj($oShell) Then ; Get zip file object Local $oFolder = $oShell.NameSpace ($sZip) If Not @error And IsObj($oFolder) Then ; Copy source file or folder to zip file If StringInStr(FileGetAttrib($sSrc), "D") Then $oFolder.CopyHere ($oShell.NameSpace ($sSrc).items) Else $oFolder.CopyHere ($sSrc) EndIf Sleep(1000) If @error Then Return SetError(5, 0, 0) Else Return 1 EndIf Else Return SetError(4, 0, 0) EndIf Else Return SetError(3, 0, 0) EndIf Else Return SetError(2, 0, 0) EndIfEndFunc ;==>_ZipAdd;----------------------------------; Function _ZipList($sZip); List the contents of a .zip archive file; Where: $sZip is the .zip file; On Success, returns a 1D array of items in the zip file, with [0]=count; On fail, returns array with [0]=0 and @Error is:; 1 = Zip file did not exist; 2 = Shell ObjCreate error; 3 = Zip file namespace object error; 4 = Error copying data;----------------------------------Func _ZipList($sZip) Local $aNames[1] =[0], $i; Test zip file If FileExists($sZip) Then ; Create shell object Local $oShell = ObjCreate('Shell.Application') If Not @error And IsObj($oShell) Then ; Get zip file object Local $oFolder = $oShell.NameSpace ($sZip) If Not @error And IsObj($oFolder) Then ; Get list of items Local $oItems = $oFolder.Items () If Not @error And IsObj($oItems) Then ; Read items into array For $i In $oItems $aNames[0] += 1 ReDim $aNames[$aNames[0] + 1] $aNames[$aNames[0]] = $oFolder.GetDetailsOf ($i, 0) Next Else SetError(4) EndIf Else SetError(3) EndIf Else SetError(2) EndIf Else SetError(1) EndIf Return $aNamesEndFunc ;==>_ZipList;----------------------------------; Function _UnZip($sZip, $sDest, $particular_item = ""); Uncompress items from a .zip file to a destination folder.; Where:; $sZip is the .zip file; $sDest is the folder to uncompress to (without trailing '\'); $particular_item is an option that allows for specifying individual file to extract; Returns 1 on success, 0 for fail; On fail, @Error is:; 1 = Source zip file did not exist; 2 = Error creating destination folder; 3 = Shell ObjCreate error; 4 = Zip file namespace object error; 5 = Error creating item list object; 6 = Destination folder namespace object error; 7 = Error copying data;----------------------------------Func _UnZip($sZip, $sDest, $particular_item = ""); Test zip file If FileExists($sZip) Then ; Test destination folder If Not FileExists($sDest) Then If Not DirCreate($sDest) Then Return SetError(2, 0, 0) EndIf ; Create shell object Local $oShell = ObjCreate('Shell.Application') If Not @error And IsObj($oShell) Then ; Get zip file namespace object Local $oFolder = $oShell.NameSpace ($sZip) If Not @error And IsObj($oFolder) Then ; Get list of items in zip file If $particular_item = "" Then Local $oItems = $oFolder.Items () Else ;$particular_item = StringReplace($particular_item, "", "/") Local $oItems = $oFolder.ParseName ($particular_item) EndIf If Not @error And IsObj($oItems) Then ; Get destination folder namespace object $oDest = $oShell.NameSpace ($sDest & "\") If Not @error And IsObj($oDest) Then ; Copy the files $oDest.CopyHere ($oItems) Sleep(500) If @error = 0 Then Return 1 Else Return SetError(7, 0, 0) EndIf Else Return SetError(6, 0, 0) EndIf Else Return SetError(5, 0, 0) EndIf Else Return SetError(4, 0, 0) EndIf Else Return SetError(3, 0, 0) EndIf Else Return SetError(1, 0, 0) EndIfEndFunc ;==>_UnZip Edited December 14, 2008 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) 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