Jump to content
torels

ZIP.au3 UDF in pure AutoIt

Recommended Posts

Hung

Hi, Can you help me,pls. i have some code :
#include "zip.au3"


_Zip_UnzipAll(@scripdir & "\Xin chào mọi người.zip",@scripdir&"\file")

It not work. I think zip.au3 not work with link UTF - 8. Can you help me ! thks

Share this post


Link to post
Share on other sites
Jos

Do you mean that it can't handle filenames with these special characters?
The UDF itself is using the standard windows com object "Shell.Application" to unzip, so not much that can be changed there.

Jos

  • Like 1

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Hung

Thks Pro :(

Share this post


Link to post
Share on other sites
TekWeis

Just wanted to say thank you for this UDF.

I was able to study it and make an additional function to it based on my needs. Great UDF to use and learn from.

 

-Chris

Share this post


Link to post
Share on other sites
gishi
"c:\\Zip.au3" (456) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$ZipFile = $ZipSplit[2]
$ZipFile = ^ ERROR
->08:24:55 AutoIt3.exe ended.rc:1
+>08:24:55 AutoIt3Wrapper Finished.
Process exited with code 1

 

Edited by gishi

Share this post


Link to post
Share on other sites
gishi

well i figured it out... it was the cmd stuff at the beginning of the udf.....

Edited by gishi

Share this post


Link to post
Share on other sites
Roland

It seems dat zip.au3 doesn't work under de lastest version of Windows 10. 

Windows 10 has discontinued support for direct calls to internal zip functions embedded in Windows 10.

I build a script to unzip certain files. They work fine in windows 8.1 but don't do anything in Windows 10.

 

Share this post


Link to post
Share on other sites
t0nZ

Hi to all and HI to @wraithdu and @torels and @Jos

I am pretty sure this UDF is working from win7 to win 10, I remotely manage two hundreds of win machines, and the vast majority are the various recent updates of win10 .

I report this because I have read previous posts and today I have a particular problem, the UDF is still working zipping and unzipping but on some subversions of win10  I noticed this:

consider the function _Zip_UnzipAll

; #FUNCTION# ====================================================================================================
; Name...........:  _Zip_UnzipAll
; Description....:  Extract all files contained in a ZIP archive
; Syntax.........:  _Zip_UnzipAll($sZipFile, $sDestPath[, $iFlag = 20])
; Parameters.....:  $sZipFile   - Full path to ZIP file
;                   $sDestPath  - Full path to the destination
;                   $iFlag      - [Optional] File copy flags (Default = 4+16)
;                               |   4 - No progress box
;                               |   8 - Rename the file if a file of the same name already exists
;                               |  16 - Respond "Yes to All" for any dialog that is displayed
;                               |  64 - Preserve undo information, if possible
;                               | 256 - Display a progress dialog box but do not show the file names
;                               | 512 - Do not confirm the creation of a new directory if the operation requires one to be created
;                               |1024 - Do not display a user interface if an error occurs
;                               |2048 - Version 4.71. Do not copy the security attributes of the file
;                               |4096 - Only operate in the local directory, don't operate recursively into subdirectories
;                               |8192 - Version 5.0. Do not copy connected files as a group, only copy the specified files
;
; Return values..:  Success     - 1
;                   Failure     - 0 and sets @error
;                               | 1 - zipfldr.dll does not exist
;                               | 2 - Library not installed
;                               | 3 - Not a full path
;                               | 4 - ZIP file does not exist
;                               | 5 - Failed to create destination (if necessary)
;                               | 6 - Failed to open destination
;                               | 7 - Failed to extract file(s)
; Author.........:  wraithdu, torels
; Modified.......:
; Remarks........:  Overwriting of destination files is controlled solely by the file copy flags (ie $iFlag = 1 is NOT valid).
; Related........:
; Link...........:
; Example........:
; ===============================================================================================================
Func _Zip_UnzipAll($sZipFile, $sDestPath, $iFlag = 20)
    If Not _Zip_DllChk() Then Return SetError(@error, 0, 0)
    If Not _IsFullPath($sZipFile) Or Not _IsFullPath($sDestPath) Then Return SetError(3, 0, 0)
    ; get temp dir created by Windows
    Local $sTempDir = _Zip_TempDirName($sZipFile)
    Local $oNS = _Zip_GetNameSpace($sZipFile)
    If Not IsObj($oNS) Then Return SetError(4, 0, 0)
    $sDestPath = _Zip_PathStripSlash($sDestPath)
    If Not FileExists($sDestPath) Then
        DirCreate($sDestPath)
        If @error Then Return SetError(5, 0, 0)
    EndIf
    Local $oNS2 = _Zip_GetNameSpace($sDestPath)
    If Not IsObj($oNS2) Then Return SetError(6, 0, 0)
    $oNS2.CopyHere($oNS.Items(), $iFlag)
    ; remove temp dir created by WIndows
    DirRemove($sTempDir, 1)
    gollog("DEBUG-> " & $sDestPath & "\" & $oNS.Items().Item($oNS.Items().Count - 1).Name) ; NSC debuG !!
    If FileExists($sDestPath & "\" & $oNS.Items().Item($oNS.Items().Count - 1).Name) Then
        ; success... most likely
        ; checks for existence of last item from source in destination
        Return 1
    Else
        ; failure
        Return SetError(7, 0, 0)
    EndIf
EndFunc   ;==>_Zip_UnzipAll

unzipping files.zip on some win10 machines I obtain error 7 (impossible to unzip)

But it's not true, the files are correctly unzipped.

The function returns error 7 because I repeat myself only on some win10 machines 

this :

If FileExists($sDestPath & "\" & $oNS.Items().Item($oNS.Items().Count - 1).Name) Then

returns the "filename" and not the "filename.jpg"

It checks if exist the extracted file but it doesn't find it because it lacks the .extension.

I also think the real problem is in _Zip_GetNameSpace Func, related to "Shell.application" win stuff.

Any ideas ??

Regards to all

Share this post


Link to post
Share on other sites

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

×