SadBunny Posted September 24, 2007 Share Posted September 24, 2007 Thanks bull! You is teh man! I will try it as soon as I have time, thanks for your quick work! Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
SadBunny Posted September 24, 2007 Share Posted September 24, 2007 Thanks bull! You is teh man! I will try it as soon as I have time, thanks for your quick work!Seems to work on W98. I wrote a small 3 lines testing app and that now works! Thanks for the quick reaction. You the man, again! Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
eltorro Posted September 24, 2007 Author Share Posted September 24, 2007 Great!. The call was to PathFileExists in shlwapi.dll. I used another method which does not call it. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
Kerros Posted October 31, 2007 Share Posted October 31, 2007 I'm really excited about using this plugin in a file sorter script that I'm writting, but for some reason, 90% of the time when I create a zip file I get a 0Kb file, and it says that it's corrupt. Can anyone see something in my code that I'm doing wrong, as I'm starting to pull what little hair I have left out. CODEFunc _zip($ZPath, $ZFile) Local $handle, $v_ret If (($handle = PluginOpen("C:\Au3Zip\bin\Au3Zip.dll")) <> 0) Then $ZR_RECENT = 1 $ZName = $ZPath & $ZFile & "_" & @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC & "_.zip" $v_ret = _ZipCreate ($ZName) ConsoleWrite("Zip Create returned: " & $v_ret & @CRLF) $v_ret = _ZipAdd ($ZName, $ZPath & $ZFile, $ZFile) ConsoleWrite("Zip add returned: " & _ZipFormatMessage ($v_ret) & @CRLF) $v_ret = _ZipClose ($ZName) ConsoleWrite("Zip Close returned: " & _ZipFormatMessage ($v_ret) & @CRLF) ConsoleWrite("Zipped File: " & $ZName & @CRLF) ;check if file exists $size = FileGetSize($ZName) ConsoleWrite("Zip File size: " & $size & @CRLF) If FileExists($ZName) = 1 And $size = 0 Then ;try different way of adding file $v_ret = _ZipAddFileToZip ($ZName, $ZPath & $ZFile, $ZFile) ConsoleWrite("Zip add again returned: " & _ZipFormatMessage ($v_ret) & @CRLF) EndIf ;Give script a chance to stop before deleting file $numitems = _ZipGetCount ($ZName) MsgBox(0, "Zip Count after add again", _ZipFormatMessage ($numitems)) FileDelete($ZPath & $ZFile) ConsoleWrite("Deleted File: " & $ZPath & $ZFile & @CRLF) EndIf $ZName = "" PluginClose($handle) Return EndFunc ;==>_zip here is output from the consolewrites CODEFile to Sort File_Name.xls Zip Create returned: 0x00234008 Zip add returned: Success Zip Close returned: Success Zipped File: Z:\File\Path\File_Name.xls_2007-10-31_09-51-29_.zip Zip File size: 0 Zip add again returned: Zipfile is corrupt or not a zipfile I could post where I'm calling the function, but it's basically just trying to decide where to put the file and not related to the zip function. With the exception of where I call the zip function which is: _zip($move_path, $filearray[$file_to_zip]) Thanks for any help you guys could give me. Kerros Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance. Link to comment Share on other sites More sharing options...
eltorro Posted March 20, 2008 Author Share Posted March 20, 2008 (edited) I realize that Kerros' post is months old, however, it still needed to be addressed. expandcollapse popupFunc _zip($ZPath, $ZFile) Local $handle, $v_ret If (($handle = PluginOpen("C:\Au3Zip\bin\Au3Zip.dll")) <> 0) Then $ZR_RECENT = 1 $ZName = $ZPath & $ZFile & "_" & @YEAR & "-" & @MON & "-" & @MDAY & "_" & @HOUR & "-" & @MIN & "-" & @SEC & "_.zip" ConsoleWrite($ZName&@lf) ;create zip file, the return value is a handle that is need by the other functions. Local $hZip = _ZipCreate ($ZName) ;check that return value is not 0 or null if $hZip Then ;have handle, add the file[s] $v_ret = _ZipAdd ($hZip, $ZPath & $ZFile, $ZFile) ConsoleWrite("Zip add returned: " & _ZipFormatMessage ($v_ret) & @CRLF) ;done adding file, close the zip. $v_ret = _ZipClose ($hZip) ConsoleWrite("Zip Close returned: " & _ZipFormatMessage ($v_ret) & @CRLF) ConsoleWrite("Zipped File: " & $ZName & @CRLF) Else ;no handle ConsoleWrite("Could not create zip file" & $ZName & @lf) PluginClose($handle) EndIf ;check if file exists If FileExists($ZName) Then $size = FileGetSize($ZName) ConsoleWrite("Zip File size: " & $size & @CRLF) If $size = 0 Then ;try different way of adding file $v_ret = _ZipAddFileToZip ($ZName, $ZPath & $ZFile, $ZFile) ConsoleWrite("Zip add again returned: " & _ZipFormatMessage ($v_ret) & @CRLF) EndIf ;Give script a chance to stop before deleting file $numitems = _ZipGetCount ($ZName) MsgBox(0, "Zip Count after add again", _ZipFormatMessage ($numitems)) ;delete the original file??? ;~ FileDelete($ZPath & $ZFile) ;~ ;ConsoleWrite("Deleted File: " & $ZPath & $ZFile & @CRLF) EndIf $ZName = "" PluginClose($handle) Return EndFunc ;==>_zipoÝ÷ Øè¶Ë«zØZ´uèæ¥rW¦èº×+y«b³âì"¶azn)좫yªÞiÊ.¦W¨}ƯzÛéÜæxÎ*b¶+"+µ©í¶ÞjX³zØZµ© ·µêÞ¶ê籨ZÙ^N¬©Ýè¬ç~Ùu©×C¶b¤]]z¶§u© Z,y«¢+ØíÍ¥ÕͽÈÉÑ¥¹é¥À¸)1½°ÀÌØí¡A±Õ¥¸°ÀÌØí¡i¥À°ÀÌØíiI}I 9PôÄ(ÀÌØí¡A±Õ¥¸ôA±Õ¥¹=Á¸¡MÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈíÔÍi¥À¹±°ÅÕ½Ðì¤)%ÀÌØí¡A±Õ¥¸Q¡¸(í¡¹±¥ÌÉÑÕɹä}i¥Á ÉÑ(ÀÌØí¡i¥Àô}i¥Á ÉÑ¡MÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈíµå}¹Ý}é¥À¹é¥ÀÅÕ½Ðì¤(%ÀÌØí¡i¥ÀQ¡¸(íQ¡¡¹±¥ÌÕ͡ɸ(}i¥Á ÀÌØí¡i¥À±MÉ¥ÁѥȵÀìÅÕ½ÐìÀäÈíͽµ¹¥±ÅÕ½Ðì°ÅÕ½Ðíͽµ¹¥±ÅÕ½Ðì¤(í¹¡É¸(}i¥Á ±½Í ÀÌØí¡i¥À¤(±Í(5Í ½à ÈØØÈàà°ÅÕ½ÐíÉɽÈÅÕ½Ðì±}i¥Á½ÉµÑ5ÍÍ ÀÌØíiI}I 9P¤¤(¹%(A±Õ¥¹ ±½Í ÀÌØí¡A±Õ¥¸¤(¹% The other functions take the zip filename and assume that the zip file is already be created and properly closed (either by this plugin or some other zip product). Edited April 2, 2008 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
evilertoaster Posted April 14, 2008 Share Posted April 14, 2008 There is a possible bug when trying to unzip a 0 byte file from an archive. An example of this can be seen in the Scite4Autoit3.zip file from http://www.autoitscript.com/autoit3/scite/downloads.shtmlDiscovered in the help forum- http://www.autoitscript.com/forum/index.ph...mp;#entry506193 Link to comment Share on other sites More sharing options...
eltorro Posted April 15, 2008 Author Share Posted April 15, 2008 I'll take a look as soon as I can. It's been a while since I looked at the code so I'll have to get familiar with it. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
eltorro Posted April 15, 2008 Author Share Posted April 15, 2008 There is a possible bug when trying to unzip a 0 byte file from an archive. An example of this can be seen in the Scite4Autoit3.zip file from http://www.autoitscript.com/autoit3/scite/downloads.shtmlDiscovered in the help forum- http://www.autoitscript.com/forum/index.ph...mp;#entry506193I uploaded build 407 which should take care of the the problem. Please see first post for download linkage. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
fRequEnCy Posted April 15, 2008 Share Posted April 15, 2008 Great Tool! Just what I was looking for. Thanks! Have a question: Is it possible to use wildcards? I'm trying to unzip specific files within zip. For example (*.txt) Link to comment Share on other sites More sharing options...
eltorro Posted April 15, 2008 Author Share Posted April 15, 2008 Great Tool! Just what I was looking for. Thanks! Have a question: Is it possible to use wildcards? I'm trying to unzip specific files within zip. For example (*.txt) Unfortunately, no, wildcards are not supported. You could implement this in code though. This extracts all the .htm files from SciTE4AutoIt3.zip #include-once #Include <_ZipPlugin.au3> $szZipFile = "C:\SciTE4AutoIt3.zip" $szDestDir = "C:\inzip\htm" $szPluginPath = @ScriptDir &"\Au3Zip.dll" $hPluginDll = PluginOpen($szPluginPath) If $hPluginDll = -1 Then MsgBox(266288,"Error:","Plugin not initialized.") Exit EndIf $aZipList = _ZipList2Array($szZipFile) for $x =0 to UBound($aZipList)-1 If StringLower(StringRight($aZipList[$x][1],4)) = ".htm" Then ConsoleWrite("Extracting:"&$aZipList[$x][1]) $vResult = _ZipUnZipItem($szZipFile,$aZipList[$x][1],$szDestDir) ConsoleWrite(" -- "&_ZipFormatMessage($ZR_RECENT)&@lf) EndIf Next PluginClose($hPluginDll) It could be wrapped into a function. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
fRequEnCy Posted April 17, 2008 Share Posted April 17, 2008 Unfortunately, no, wildcards are not supported. You could implement this in code though. This extracts all the .htm files from SciTE4AutoIt3.zip #include-once #Include <_ZipPlugin.au3> $szZipFile = "C:\SciTE4AutoIt3.zip" $szDestDir = "C:\inzip\htm" $szPluginPath = @ScriptDir &"\Au3Zip.dll" $hPluginDll = PluginOpen($szPluginPath) If $hPluginDll = -1 Then MsgBox(266288,"Error:","Plugin not initialized.") Exit EndIf $aZipList = _ZipList2Array($szZipFile) for $x =0 to UBound($aZipList)-1 If StringLower(StringRight($aZipList[$x][1],4)) = ".htm" Then ConsoleWrite("Extracting:"&$aZipList[$x][1]) $vResult = _ZipUnZipItem($szZipFile,$aZipList[$x][1],$szDestDir) ConsoleWrite(" -- "&_ZipFormatMessage($ZR_RECENT)&@lf) EndIf Next PluginClose($hPluginDll) It could be wrapped into a function. Awesome! Works and so simple after your example. Thanks so much eltorro! Link to comment Share on other sites More sharing options...
henry1 Posted April 17, 2008 Share Posted April 17, 2008 Hi eltorro, Could you please give more detail explanation on how to use this program? Should I run it on MS dos prompt? My operating system is Windows XP. I tried to open "PluginZip.au3" from Scite and it worked. However, there is only 2 buttons (Go and Exit). Could you please explain what's should I do to see the zip or unzip features? Thank you. Henry Link to comment Share on other sites More sharing options...
eltorro Posted April 17, 2008 Author Share Posted April 17, 2008 Hi eltorro, Could you please give more detail explanation on how to use this program? Should I run it on MS dos prompt? My operating system is Windows XP. I tried to open "PluginZip.au3" from Scite and it worked. However, there is only 2 buttons (Go and Exit). Could you please explain what's should I do to see the zip or unzip features? Thank you. What you are referring to is just an example program using the plugin dll. The program you saw is the results of using the plugin in a gui program. It zips up some file, and then extracts some files. The plugin expands the capabilities of AutoIt and can be used in either command line or gui programs, whichever you choose to write. There are several examples contained in the posts of this topic on how to use the plugin. Here is one. Look about 2/3 of the way down. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
Greenhorn Posted April 18, 2008 Share Posted April 18, 2008 Hi elTorro, at first -> many thanx for developing this great Plugin !!! I have a little feature request and if you agree that it is useful then read on, please ... It would be nice to have a _ZipUnZipFolder($zipfile, $dest, 'xfolder/yfolder2/zfolder') function and/or support for using wildcards . So that I'm able to extract the folder 'zfolder' from an archive and/or that I could extract all '*.bmp' - or just '*', '*.*', etc. - items from an archive folder. Is this possible to realize ? Thanx for notice ... Greetz Greenhorn Link to comment Share on other sites More sharing options...
henry1 Posted April 18, 2008 Share Posted April 18, 2008 Hi Eltorro, There are several examples contained in the posts of this topic on how to use the plugin. Here is one. Look about 2/3 of the way down. Is this the code that you mentioned? #include <_ZipPlugin.au3> ;basic usage for creating a zip. Local $hPlugin, $hZip , $ZR_RECENT = 1 $hPlugin = PluginOpen(@ScriptDir&"\Au3Zip.dll") If $hPlugin Then ;a handle is returned by _ZipCreate $hZip = _ZipCreate(@ScriptDir&"\test.zip") If $hZip Then ;The handle is used here. _ZipAdd($hZip,@ScriptDir&"\readme.txt","readme.txt") ;And here. _ZipClose($hZip) Else MsgBox(266288,"Error",_ZipFormatMessage($ZR_RECENT)) EndIf PluginClose($hPlugin) EndIf So, is this code basically will Open Au3Zip.dll plugin, create the "test.zip" in the @scriptdir (working directory) and it will add "readme.txt" from @scriptdir to inside "test.zip"? Apologies in advance because this is my first time learning how to use your plugin. Do you have manual guide on how to use this plugin and installation? Thank you. Henry Link to comment Share on other sites More sharing options...
eltorro Posted April 18, 2008 Author Share Posted April 18, 2008 (edited) Hi elTorro, at first -> many thanx for developing this great Plugin !!! I have a little feature request and if you agree that it is useful then read on, please ... It would be nice to have a _ZipUnZipFolder($zipfile, $dest, 'xfolder/yfolder2/zfolder') function and/or support for using wildcards . So that I'm able to extract the folder 'zfolder' from an archive and/or that I could extract all '*.bmp' - or just '*', '*.*', etc. - items from an archive folder. Is this possible to realize ? Thanx for notice ... Greetz Greenhorn Ok, I gave it a shot. expandcollapse popup; #EXAMPLE ========================================================================= ; _ZipUnZipMatch ; ================================================================================== #Include <user\_ZipPlugin.au3> $sZipFile = "C:\SciTE4AutoIt3.zip" $sDestDir = "C:\inzip\test" $szPluginPath = @ScriptDir &"\Au3Zipc.dll" $hPluginDll = PluginOpen($szPluginPath) If $hPluginDll = -1 Then MsgBox(266288,"Error:","Plugin not initialized.") Exit EndIf If Not FileExists($sDestDir) Then DirCreate($sDestDir) ;unzip all .htm and .properties files _ZipUnZipMatch($sZipFile,$sDestDir,"*.htm;*.properties") If @error Then ConsoleWrite("Error -- "&_ZipFormatMessage(@extended)&@lf) Else ConsoleWrite(" -- "&_ZipFormatMessage($ZR_RECENT)&@lf) EndIf PluginClose($hPluginDll) ; #FUNCTION# ======================================================================= ; Name ..........: _ZipUnZipMatch ; Description ...: Unzips its based on MS-DOS ? and * pattern match. ; Parameters ....: $szZipFile - IN - The source zip file ; $szDestDir - IN - The directory where the items will be extracted ; $szPattern - IN - The wild card pattern ; $iCs - IN/OPTIONAL - Use case sensitivity [0/1] defaults to 0= no ; Return values .: On success - 1 ; On Failure - 0, @error set to 1 @extended set to zip error code ; Author ........: Stephen Podhajecki {gehossafats at netmdc. com} ; Modified.......: ; Remarks .......: Matches * and ? in an MS-DOS way. ; Related .......: ; Link ..........; ; Example .......; [yes/no] ; ================================================================================== Func _ZipUnZipMatch($szZipFile,$szDestDir,$szPattern,$iCs = 0) Local $vResult = 0 Local $aZipList = _ZipList2Array($szZipFile) For $x =0 to UBound($aZipList) -1 If __WildCardMatch($aZipList[$x][1],StringReplace($szPattern,"/","\"),$iCs) Then ConsoleWrite($aZipList[$x][1]&@lf) $vResult = _ZipUnZipItem($szZipFile,$aZipList[$x][1],$szDestDir) If $vResult <> 0 Then Return SetError(1,$vResult,0) EndIf Next Return 1 EndFunc ; #FUNCTION# ======================================================================= ; Name ..........: _WildCardMatch ; Description ...: Matches patterns based on * and ? similar the MSDOS. ; Parameters ....: $szData - IN - The data to test for match ; $szPattern - IN - The pattern to match ; $iCaseSensitive - IN/OPTIONAL - Turn case sensitivity on or off. ; $iMsDosCompat -IN/OPTIONAL - Turn MS compatibility on or off ; Return values .: On Success - 1 ; On Failure - 0 ; Author ........: Stephen Podhajecki {gehossafats at netmdc. com} ; Modified.......: ; Remarks .......: When MS compatibility mode = 1 then *.log with also match test.log_1 ; See the remarks in the Au3 help file for FileFindFirstFile. ; Related .......: ; Link ..........; ; Example .......; [yes/no] ; ================================================================================== Func __WildCardMatch($szData, $szPattern,$iCaseSensitive = 0,$iMsCompat = 0) If $szData = "" or $szPattern = "" Then Return 0 If ($szPattern = "*" or _ ($szPattern = "?" And Not(StringInstr($szData,"."))) or _ ($iMsCompat And $szPattern = "??")) Then Return 1 Local $rPat = "^("& $szPattern & ")" $rPat = StringReplace($rPat,"\","\\") ;escape backslashes $rPat = StringReplace($rPat,"+","\+") ;escape + so it will match $rPat = StringReplace($rPat,".","\.") ;escape the . so it will match $rPat = StringReplace($rPat,"?","." ) ;change ? to . to match single character $rPat = StringReplace($rPat,"*",".*") ;change * to .* to match multiple characters $rPat = StringReplace($rPat,";","|" ) ;change semi-colon to pipe for "or" match. If $iMsCompat = 0 then $rPat &= "$" ; *.log will match test.log_1 If $iCaseSensitive = 0 Then $rPat = "(?i)"&$rPat Return StringRegExp($szData,$rPat,0) EndFunc The regex might need tweeking, however it seems to return correct results. Edit: Tweeked the regex a little bit Edited April 19, 2008 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
eltorro Posted April 18, 2008 Author Share Posted April 18, 2008 (edited) Hi Eltorro, Is this the code that you mentioned? #include <_ZipPlugin.au3> ;basic usage for creating a zip. Local $hPlugin, $hZip , $ZR_RECENT = 1 $hPlugin = PluginOpen(@ScriptDir&"\Au3Zip.dll") If $hPlugin Then ;a handle is returned by _ZipCreate $hZip = _ZipCreate(@ScriptDir&"\test.zip") If $hZip Then ;The handle is used here. _ZipAdd($hZip,@ScriptDir&"\readme.txt","readme.txt") ;And here. _ZipClose($hZip) Else MsgBox(266288,"Error",_ZipFormatMessage($ZR_RECENT)) EndIf PluginClose($hPlugin) EndIf So, is this code basically will Open Au3Zip.dll plugin, create the "test.zip" in the @scriptdir (working directory) and it will add "readme.txt" from @scriptdir to inside "test.zip"? Apologies in advance because this is my first time learning how to use your plugin. Do you have manual guide on how to use this plugin and installation? Thank you. Yes that is what the above code does. There is not a manual. In the first post it gives basic usage. There are several example in the pages of this topic. It probably would be a good idea to consolidate them somewhere. I don't really have the time to do it at the moment. If you have a particular question, post it (with the code you have so far) and I and/or someone will likely help. Installation is simple. Copy the plugin somewhere (like @ScriptDir) and place that path in PluginOpen. Edited April 18, 2008 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
henry1 Posted April 18, 2008 Share Posted April 18, 2008 Hi, Installation is simple. Copy the plugin somewhere (like @ScriptDir) and place that path in PluginOpen.Thank you. I will try to look and learn it Henry Link to comment Share on other sites More sharing options...
Greenhorn Posted April 18, 2008 Share Posted April 18, 2008 Ok, I gave it a shot. expandcollapse popup; #EXAMPLE ========================================================================= ; _ZipUnZipMatch ; ================================================================================== #Include <user\_ZipPlugin.au3> $sZipFile = "C:\SciTE4AutoIt3.zip" $sDestDir = "C:\inzip\test" $szPluginPath = @ScriptDir &"\Au3Zipc.dll" $hPluginDll = PluginOpen($szPluginPath) If $hPluginDll = -1 Then MsgBox(266288,"Error:","Plugin not initialized.") Exit EndIf If Not FileExists($sDestDir) Then DirCreate($sDestDir) ;unzip all .htm and .properties files _ZipUnZipMatch($sZipFile,$sDestDir,"*.htm;*.properties") If @error Then ConsoleWrite("Error -- "&_ZipFormatMessage(@extended)&@lf) Else ConsoleWrite(" -- "&_ZipFormatMessage($ZR_RECENT)&@lf) EndIf PluginClose($hPluginDll) ; #FUNCTION# ======================================================================= ; Name ..........: _ZipUnZipMatch ; Description ...: Unzips its based on MS-DOS ? and * pattern match. ; Parameters ....: $szZipFile - IN - The source zip file ; $szDestDir - IN - The directory where the items will be extracted ; $szPattern - IN - The wild card pattern ; $iCs - IN/OPTIONAL - Use case sensitivity [0/1] defaults to 0= no ; Return values .: On success - 1 ; On Failure - 0, @error set to 1 @extended set to zip error code ; Author ........: Stephen Podhajecki {gehossafats at netmdc. com} ; Modified.......: ; Remarks .......: Matches * and ? in an MS-DOS way. ; Related .......: ; Link ..........; ; Example .......; [yes/no] ; ================================================================================== Func _ZipUnZipMatch($szZipFile,$szDestDir,$szPattern,$iCs = 0) Local $vResult = 0 Local $aZipList = _ZipList2Array($szZipFile) For $x =0 to UBound($aZipList) -1 If __WildCardMatch($aZipList[$x][1],StringReplace($szPattern,"/","\"),$iCs) Then ConsoleWrite($aZipList[$x][1]&@lf) $vResult = _ZipUnZipItem($szZipFile,$aZipList[$x][1],$szDestDir) If $vResult <> 0 Then Return SetError(1,$vResult,0) EndIf Next Return 1 EndFunc ; #FUNCTION# ======================================================================= ; Name ..........: _WildCardMatch ; Description ...: Matches patterns based on * and ? similar the MSDOS. ; Parameters ....: $szData - IN - The data to test for match ; $szPattern - IN - The pattern to match ; $iCaseSensitive - IN/OPTIONAL - Turn case sensitivity on or off. ; Return values .: On Success - 1 ; On Failure - 0 ; Author ........: Stephen Podhajecki {gehossafats at netmdc. com} ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; [yes/no] ; ================================================================================== Func __WildCardMatch($szData, $szPattern,$iCaseSensitive = 0) If $szData = "" or $szPattern = "" Then Return 0 If $szPattern = "*" Then Return 1 If $szPattern = "?" And Not(StringInstr($szData,".")) Then Return 1 Local $rPat="(" $rPat &= StringReplace($szPattern,"\","\\");escape backslashes $rPat = StringReplace($rPat,".","\.");escape the . so it will match $rPat = StringReplace($rPat,"?",".") ;change ? to . to match single character $rPat = StringReplace($rPat,"*",".*");change * to .* to match multiple characters $rPat = StringReplace($rPat,";","|") &"){:content:}quot;; change semi-colon to pipe for "or" match. If $iCaseSensitive = 0 Then $rPat = "(?i)"&$rPat EndIf Return StringRegExp($szData,$rPat,0) EndFunc The regex might need tweeking, however it seems to return correct results. Great ! Thanx a lot for support ! I will try it out and post results. Greetz Greenhorn Link to comment Share on other sites More sharing options...
OnTheFly Posted April 23, 2008 Share Posted April 23, 2008 Hi, i have this code: #Include "VelkyPortable\Data\Backup\_ZipPlugin.au3" $handle = PluginOpen(@ScriptDir & "\VelkyPortable\Data\Backup\Au3Zip.dll") $hFile = _ZipCreate(@ScriptDir & "\VelkyPortable\Backups\" & $app & "_" & @YEAR & "-" & @MON & "-" & @MDAY & ".zip") $v_ret = _ZipAddDir($hFile,@ScriptDir & "\VelkyPortable\Portable Apps\" & $cat & "\" & $app ,0) $v_ret = _ZipClose($hFile) PluginClose($handle) It keeps giving me a 22byte large Zip file. (Which don't work) Why? 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