wraithdu Posted April 10, 2011 Author Share Posted April 10, 2011 You are misusing arrays. $array = _Zip_List(file) $array[0] => count $array[n] => files Link to comment Share on other sites More sharing options...
mircea Posted April 10, 2011 Share Posted April 10, 2011 Still dosen't work here's the code.The only thing i want is to show me the name of the file (inside the zip is a .xml file for example test.xml) and i want to have acces to read some data from the .xml fileThank you (The problem is i have some problems with array's and i don't understand them to well)#include <Zip.au3> #include <Array.au3> Local $Array[2] $array = _Zip_List("c:\logs\Test.zip") $array[0] = MsgBox(0,"work",$Array) $array[1] = Msgbox(0,"Work",$Array) Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted April 10, 2011 Share Posted April 10, 2011 THere's a array tutorial in the wiki. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
mircea Posted April 10, 2011 Share Posted April 10, 2011 (edited) Off topic Thank you for the tutorial but usually im using the help file that's included with the autoit. And i understand that Array it's a big variable that differs only the numbers. But usually im getting stuck cause it's hard for me for now.. to understand what goes were But thank you for the link Example: Edit on topic; Seems like it's working but it dosen't show me the name only the count 1 #include <array.au3> Local $Me[9] $me[0] = "Hello" $Me[1] = "Can" $me[2] = "you" $Me[3] = "help" $Me[4] = "me" $Me[5] = "With" $me[6] = "The" $me[7] = "zip" $me[8] = "file" _ArrayDisplay($me, "$me set manually 1D") Edited April 10, 2011 by mircea Link to comment Share on other sites More sharing options...
wraithdu Posted April 10, 2011 Author Share Posted April 10, 2011 _Zip_List works for me. Is your XML file in the root of the zip file? _Zip_List only lists files in the root of the zip. This behavior is documented in the function header. If you want read access, you need to extract the file. Also, please don't make this thread about teaching you how to use arrays. Post that kind of question in the General forum. Link to comment Share on other sites More sharing options...
wraithdu Posted April 10, 2011 Author Share Posted April 10, 2011 (edited) #include <Zip.au3> #include <Array.au3> Local $Array[2] $array = _Zip_List("c:\logs\Test.zip") $array[0] = MsgBox(0,"work",$Array) $array[1] = Msgbox(0,"Work",$Array) This is entirely ridiculous and your problem has nothing to do with my UDF. Read the help file and learn to use arrays. Post any further questions in the General forum. Edited April 10, 2011 by wraithdu Link to comment Share on other sites More sharing options...
mircea Posted April 10, 2011 Share Posted April 10, 2011 Ok, thank you and sorry Link to comment Share on other sites More sharing options...
rmeske Posted April 21, 2011 Share Posted April 21, 2011 First let me say thank you for this script, it is very helpful. I have tried digging around to find out how to use some of the features but as of yet have not found any. For example, in the _Zip_Additem function one of the flags indicates it will show a progress box with no file name, however I can't seem to get it to show up. Is there any further help anywhere or examples of how to use the functions? I also have a compatibility issue with this UDF and the IE UDF. When both are included in a script, I get warnings for the two functions; _IEAttach and __IEIsObjType. The warnings read like: IE.au3 V2.4-0 Warning from function _IEAttach, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler) Everything still seems to work, but thought I would mention it. Link to comment Share on other sites More sharing options...
wraithdu Posted April 21, 2011 Author Share Posted April 21, 2011 1) The flags are general flags for the Shell.Application object's CopyHere method. Not all of these flags seem to be supported by the zipfldr.dll library and I can't find any clear documentation describing the library's specific behavior. You'll just have to experiment, YMMV. 2) My UDF also registers a COM error handler like the IE UDF. I guess the IE UDF isn't very graceful when there's already a COM error handler registered. Try #include 'ing the IE UDF before mine, and mine should handle it better. Or, as you said, ignore the IE warnings, unless there's some special functionality in the IE UDF error handler that you need to retain. Link to comment Share on other sites More sharing options...
roofninja Posted May 24, 2011 Share Posted May 24, 2011 I want to start by saying thanks for the great UDF. It is going to make my life easier. I do have a problem with _Zip_UzipAll function when using flags. The problem seems for me is when the directory and files already exist. The pop-up message for me is to over write "yes" or "yes for all" keeps coming up. I am using the flag of 16+256=272. RUN . . . Slide . . . TAG . . . Your out . . . PAINTBALL !!! Link to comment Share on other sites More sharing options...
wraithdu Posted May 24, 2011 Author Share Posted May 24, 2011 (edited) Read the rest of the thread regarding flags. I'm not explaining it again (you can start with the post directly ABOVE yours). Edited May 24, 2011 by wraithdu Link to comment Share on other sites More sharing options...
tbaror Posted June 2, 2011 Share Posted June 2, 2011 Hi All, I am trying to add entire folder and files and sub-folder into zip but its not happen the zip is created but stays empty , must be somthing i did worng. please advise #Include <Zip.au3> $Zip = _Zip_Create(@ScriptDir & "\LOGS_.ZIP") _Zip_AddItem($Zip, "C:\pspad\licence_cz (2).txt") Link to comment Share on other sites More sharing options...
wraithdu Posted June 2, 2011 Author Share Posted June 2, 2011 (edited) I advise you read the UDF header. Then carefully read the function headers to understand how to add a file to a specific subfolder inside the zip. However your code snippet is not adding a folder, just a text file. Are you getting some other error there? Edited June 2, 2011 by wraithdu Link to comment Share on other sites More sharing options...
wraithdu Posted June 2, 2011 Author Share Posted June 2, 2011 Your code snippet works fine for me. Remember, _Zip_Create will fail and return 0 and @error = 1 if you do not set the overwrite flag. This will cause your call to _Zip_AddItem to fail. Link to comment Share on other sites More sharing options...
RobK Posted June 29, 2011 Share Posted June 29, 2011 I am using the zip UDF dated 2010-08-07 and found that on XP computers all folders are getting some type of file that looks like a GUID {EF9FD7B5-94C9-41BE-BE69-FF72B330B5A1} any ideas why these are being created? This does not occur on a windows 7 computer. Any help would be appreciated. Thanks, Rob Link to comment Share on other sites More sharing options...
wraithdu Posted June 29, 2011 Author Share Posted June 29, 2011 Nope, no idea. Update to the current UDF in the first post, it could be related to a bug I fixed. Link to comment Share on other sites More sharing options...
RobK Posted June 29, 2011 Share Posted June 29, 2011 Nope, no idea. Update to the current UDF in the first post, it could be related to a bug I fixed.Sorry, no the GUID type files are still being created in the zip with the revised UDF. Rob Link to comment Share on other sites More sharing options...
wraithdu Posted June 29, 2011 Author Share Posted June 29, 2011 (edited) Hmm. I remember now why those files are created, but they should be deleted as well. This means that a call to _Zip_InternalDelete() is failing. As it works here, we'll have to do some troubleshooting. The function lives on line 786, and is called in the _Zip_AddItem() function from line 132. Can you change line 132 to: If $sTempFile <> "" Then Local $debug = _Zip_InternalDelete($sZipFile, $sTempFile) ConsoleWrite("debug: " & $debug & " : " & @error & @CRLF) EndIf and paste the output? It should show an error, just have to figure out why. Also, can you post some simple code that is causing the problem? Edited June 29, 2011 by wraithdu Link to comment Share on other sites More sharing options...
RobK Posted June 29, 2011 Share Posted June 29, 2011 (edited) I wrote a quick routine to try and delete the files but that fails to successfully delete on the XP machines too (works on Win7). #cs +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++ Search for GUID type of files and remove from zip (XP OS issue) +++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #ce $ZSearchGUID = _Zip_Search($LZPOSPath & "\LogArchive\" & $Datefn & "\" & $Datefn & ".zip", "{") if @error or $ZSearchGUID = 0 Then msgbox(0,"Error",$ZSearchGUID) ;on error or no files do nothing. Else _ArrayDisplay($ZSearchGUID,"Files in Zip") ;process files found and remove from zip for $i = 1 to $ZSearchGUID[0] $ZDelete = _Zip_InternalDelete($LZPOSPath & "\LogArchive\" & $Datefn & "\" & $Datefn & ".zip", $ZSearchGUID[$i]) ;delete without confirmation If @error Then msgbox(0,"Delete error",$ZSearchGUID[$i] & " " & $ZDelete) EndIf next EndIf In this case it is returning a zero (0) and from the @error condition 7 - Destination ZIP file does not exist. Edited June 29, 2011 by RobK Link to comment Share on other sites More sharing options...
wraithdu Posted June 29, 2011 Author Share Posted June 29, 2011 The error returned from _Zip_InternalDelete is different than the other functions (hence marked as internal). In this case, it means that the file was not deleted. I'll look into this further tomorrow on some older XP machines here at work (all my main machines are Win7 now, as well as my home computers), and try and find out where exactly it is failing. Truthfully I need to add a bit more error checking in that function. 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