Jump to content
Sign in to follow this  
Adrive

make a zip file and add contents of a folder in it

Recommended Posts

Adrive

Hi

i have used a UDF called Zip.au3

; AutoIt Version: 3.2
; Language:       English
; Description:    ZIP Functions.
; Author:         torels_

but when it coipes the files into the Zip file, it shows a window with the copying details.

i want to make a zip file and add all files of a folder in it, but without showing any progress bar or window.

i need some help about it.

Edited by Adrive

Share this post


Link to post
Share on other sites
NicePerson

Adrive

Post your script here!

Thanks

RMR

Share this post


Link to post
Share on other sites
Melba23

Adrive,

There is nothing in zip.au3 itself to produce a window - it must be the calling script doing so.

If you were to post the script as RMR proposed we might be able to suggest something - without it we cannot do a lot. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
UEZ

It is the windows internal thread that creates the window during the zip task!

Further classname of the zip window is different in each OS! You can use ctrl-f6 in SciTE to get classname!

BR,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Adrive

UDF:

;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <array.au3>
; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.2
; Language:       English
; Description:    ZIP Functions.
; Author:         torels_
;
; ------------------------------------------------------------------------------

If UBound($CMDLine) > 1 Then
    If $CMDLine[1] <> "" Then _Zip_VirtualZipOpen()
EndIf

;===============================================================================
;
; Function Name:    _Zip_Create()
; Description:      Create Empty ZIP file.
; Parameter(s):     $hFilename - Complete path to zip file that will be created
; Requirement(s):   none.
; Return Value(s):  Returns the Zip file path (to be used as a handle - even though it's not necessary)
; Author(s):        torels_
;
;===============================================================================
Func _Zip_Create($hFilename)
    $hFp = FileOpen($hFilename, 26)
    $sString = Chr(80) & Chr(75) & Chr(5) & Chr(6) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0)
    FileWrite($hFp, $sString)
    If @error Then Return SetError(1,0,0)
    FileClose($hFp)
    
    While Not FileExists($hFilename)
        Sleep(10)
    Wend
    Return $hFilename
EndFunc   ;==>_Zip_Create

;===============================================================================
;
; Function Name:    _Zip_AddFile()
; Description:      Add a file to a ZIP Archieve.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $hFile2Add - Complete path to the file that will be added
;                   $flag = 1
;                   - 0 ProgressBox
;                   - 1 no progress box
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
;                   On Failure - Returns False
; Author(s):        torels_
; Notes:            The return values will be given once the compressing process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_AddFile($hZipFile, $hFile2Add, $flag = 1)
    Local $DLLChk = _Zip_DllChk()
    Local $files = _Zip_Count($hZipFile)
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    $oApp = ObjCreate("Shell.Application")
    $copy = $oApp.NameSpace($hZipFile).CopyHere($hFile2Add)
    While 1
        If $flag = 1 then _Hide()
        If _Zip_Count($hZipFile) = ($files+1) Then ExitLoop
        Sleep(10)
    WEnd
    Return SetError(0,0,1)
EndFunc   ;==>_Zip_AddFile

;===============================================================================
;
; Function Name:    _Zip_AddFolder()
; Description:      Add a folder to a ZIP Archieve.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $hFolder - Complete path to the folder that will be added (possibly including "\" at the end)
;                   $flag = 1
;                   - 1 no progress box
;                   - 0 progress box
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
; Notes:            The return values will be given once the compressing process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_AddFolder($hZipFile, $hFolder, $flag = 1)
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\"
    $files = _Zip_Count($hZipFile)
    $oApp = ObjCreate("Shell.Application")
    $oCopy = $oApp.NameSpace($hZipFile).CopyHere($oApp.Namespace($hFolder))
    While 1
        If $flag = 1 then _Hide()
        If _Zip_Count($hZipFile) = ($files+1) Then ExitLoop
        Sleep(10)
    WEnd
    Return SetError(0,0,1)
EndFunc   ;==>_Zip_AddFolder

;===============================================================================
;
; Function Name:    _Zip_AddFolderContents()
; Description:      Add a folder to a ZIP Archieve.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $hFolder - Complete path to the folder that will be added (possibly including "\" at the end)
;                   $flag = 1
;                   - 1 no progress box
;                   - 0 progress box
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
; Notes:            The return values will be given once the compressing process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_AddFolderContents($hZipFile, $hFolder, $flag = 1)
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\"
    $files = _Zip_Count($hZipFile)
    $oApp = ObjCreate("Shell.Application")
    $oFolder = $oApp.NameSpace($hFolder)
    $oCopy = $oApp.NameSpace($hZipFile).CopyHere($oFolder.Items)
    $oFC = $oApp.NameSpace($hFolder).items.count
    While 1
        If $flag = 1 then _Hide()
        If _Zip_Count($hZipFile) = ($files+$oFC) Then ExitLoop
        Sleep(10)
    WEnd
    Return SetError(0,0,1)
EndFunc   ;==>_Zip_AddFolderContents

;===============================================================================
;
; Function Name:    _Zip_Delete()
; Description:      Delete a file from a ZIP Archive.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $hFolder - Complete path to the folder that will be added (possibly including "\" at the end)
;                   $flag = 1
;                   - 1 no progress box
;                   - 0 progress box
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
; Notes:            none
;
;===============================================================================
Func _Zip_Delete($hZipFile, $hFilename, $flag = 1)
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    $list = _Zip_List($hZipFile)
    $dir = @TempDir & "\tmp" & Floor(Random(0,100))
    For $i = 1 to $list[0]
        If $list[$i] <> $hFilename Then _Zip_Unzip($hZipFile,$list[$i],$dir, $flag)
    Next
    FileDelete($hZipFile)
    _Zip_Create($hZipFile)
    _Zip_AddFolderContents($hZipFile, $dir, $flag)
    DirRemove($dir)
EndFunc

;===============================================================================
;
; Function Name:    _Zip_UnzipAll()
; Description:      Extract all files contained in a ZIP Archieve.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $hDestPath - Complete path to where the files will be extracted
;                   $flag = 1
;                   - 1 no progress box
;                   - 0 progress box
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
; Notes:            The return values will be given once the extracting process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_UnzipAll($hZipFile, $hDestPath, $flag = 1)
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(2, 0, 0) ;no zip file
    If Not FileExists($hDestPath) Then DirCreate($hDestPath)
    Local $aArray[1]
    $oApp = ObjCreate("Shell.Application")
    $oApp.Namespace($hDestPath).CopyHere($oApp.Namespace($hZipFile).Items)
    For $item In $oApp.Namespace($hZipFile).Items
        _ArrayAdd($aArray, $item)
    Next
    While 1
        If $flag = 1 then _Hide()
        If FileExists($hDestPath & "\" & $aArray[UBound($aArray) - 1]) Then
            Return SetError(0, 0, 1)
            ExitLoop
        EndIf
        Sleep(500)
    WEnd
EndFunc   ;==>_Zip_UnzipAll

;===============================================================================
;
; Function Name:    _Zip_Unzip()
; Description:      Extract a single file contained in a ZIP Archieve.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $hFilename - Name of the element in the zip archive ex. "hello_world.txt"
;                   $hDestPath - Complete path to where the files will be extracted
;                   $flag = 1
;                   - 1 no progress box
;                   - 0 progress box
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
; Notes:            The return values will be given once the extracting process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_Unzip($hZipFile, $hFilename, $hDestPath, $flag = 1)
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    If Not FileExists($hDestPath) Then DirCreate($hDestPath)
    $oApp = ObjCreate("Shell.Application")
    $hFolderitem = $oApp.NameSpace($hZipFile).Parsename($hFilename)
    $oApp.NameSpace($hDestPath).Copyhere($hFolderitem)
    While 1
        If $flag = 1 then _Hide()
        If FileExists($hDestPath & "\" & $hFilename) Then
            return SetError(0, 0, 1)
            ExitLoop
        EndIf
        Sleep(500)
    WEnd
EndFunc   ;==>_Zip_Unzip

;===============================================================================
;
; Function Name:    _Zip_Count()
; Description:      Count files contained in a ZIP Archieve.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
;
;===============================================================================
Func _Zip_Count($hZipFile)
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    $items = _Zip_List($hZipFile)
    Return UBound($items) - 1
EndFunc   ;==>_Zip_Count

;===============================================================================
;
; Function Name:    _Zip_CountAll()
; Description:      Count All files contained in a ZIP Archive (including Sub Directories)
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_, Smashly
;
;===============================================================================
Func _Zip_CountAll($hZipFile)
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    $oApp = ObjCreate("Shell.Application")
    $oDir = $oApp.NameSpace(StringLeft($hZipFile, StringInStr($hZipFile, "\", 0, -1)))
    $sZipInf = $oDir.GetDetailsOf($oDir.ParseName(StringTrimLeft($hZipFile, StringInStr($hZipFile, "\", 0, -1))), -1)
    Return StringRight($sZipInf, StringLen($sZipInf) - StringInStr($sZipInf, ": ") - 1)
EndFunc

;===============================================================================
;
; Function Name:    _Zip_List()
; Description:      Returns an Array containing of all the files contained in a ZIP Archieve.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
;
;===============================================================================
Func _Zip_List($hZipFile)
    local $aArray[1]
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    $oApp = ObjCreate("Shell.Application")
    $hList = $oApp.Namespace($hZipFile).Items
    For $item in $hList
        _ArrayAdd($aArray,$item.name)
    Next
    $aArray[0] = UBound($aArray) - 1
    Return $aArray
EndFunc   ;==>_Zip_List

;===============================================================================
;
; Function Name:    _Zip_Search()
; Description:      Search files in a ZIP Archive.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $sSearchString - name of the file to be searched
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1 (no file found)
; Author(s):        torels_
; Notes:            none
;
;===============================================================================
Func _Zip_Search($hZipFile, $sSearchString)
    local $aArray
    Local $DLLChk = _Zip_DllChk()
    If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
    If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
    If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
    $list = _Zip_List($hZipFile)
    for $i = 0 to UBound($list) - 1
        if StringInStr($list[$i],$sSearchstring) > 0 Then
            _ArrayAdd($aArray, $list[$i])
        EndIf
    Next
    if UBound($aArray) - 1 = 0 Then
        Return SetError(1,0,0)
    Else
        Return $aArray
    EndIf
EndFunc ;==> _Zip_Search

;===============================================================================
;
; Function Name:    _Zip_SearchInFile()
; Description:      Search files in a ZIP Archive's File.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $sSearchString - name of the file to be searched
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1 (no file found)
; Author(s):        torels_
; Notes:            none
;
;===============================================================================
Func _Zip_SearchInFile($hZipFile, $sSearchString)
    local $aArray
    $list = _Zip_List($hZipFile)
    for $i = 1 to UBound($list) - 1
        _Zip_Unzip($hZipFile, $list[$i], @TempDir & "\tmp_zip.file")
        $read = FileRead(@TempDir & "\tmp_zip.file")
        if StringInStr($read,$sSearchstring) > 0 Then
            _ArrayAdd($aArray, $list[$i])
        EndIf
    Next
    if UBound($aArray) - 1 = 0 Then
        Return SetError(1,0,1)
    Else
        Return $aArray
    EndIf
EndFunc ;==> _Zip_Search

;===============================================================================
;
; Function Name:    _Zip_VirtualZipCreate()
; Description:      Create a Virtual Zip.
; Parameter(s):     $hZipFile - Complete path to zip file that will be created (or handle if existant)
;                   $sPath - Path to where create the Virtual Zip
; Requirement(s):   none.
; Return Value(s):  On Success - List of Created Files
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
; Notes:            none
;
;===============================================================================
Func _Zip_VirtualZipCreate($hZipFile, $sPath)
    $List = _Zip_List($hZipFile)
    If @error Then Return SetError(@error,0,0)
    If Not FileExists($sPath) Then DirCreate($sPath)
    If StringRight($sPath, 1) = "\" Then $sPath = StringLeft($sPath, StringLen($sPath) -1)
    For $i = 1 to $List[0]
        If Not @Compiled Then
            $Cmd = @AutoItExe
            $params = '"' & @ScriptFullPath & '" ' & '"' & $hZipFile & "," & $List[$i] & '"'
        Else
            $Cmd = @ScriptFullPath
            $Params = '"' & $hZipFile & "," & $List[$i] & '"'
        EndIf
        FileCreateShortcut($Cmd, $sPath & "\" & $List[$i], -1,$Params, "Virtual Zipped File", _GetIcon($List[$i], 0), "", _GetIcon($List[$i], 1))
    Next
    $List = _ArrayInsert($List, 1, $sPath)
    Return $List
EndFunc

;===============================================================================
;
; Function Name:    _Zip_VirtualZipOpen()
; Description:      Open A File in a Virtual Zip, Internal Function.
; Parameter(s):     none.
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - sets @error 1~3
;                   @error = 1 no Zip file
;                   @error = 2 no dll
;                   @error = 3 dll isn't registered
; Author(s):        torels_
; Notes:            none
;
;===============================================================================
Func _Zip_VirtualZipOpen()
    $ZipSplit = StringSplit($CMDLine[1], ",")
    $ZipName = $ZipSplit[1]
    $ZipFile = $ZipSplit[2]
    _Zip_Unzip($ZipName, $ZipFile, @TempDir & "\", 4+16) ;no progress + yes to all
    If @error Then Return SetError(@error,0,0)
    ShellExecute(@TempDir & "\" & $ZipFile)
EndFunc

;===============================================================================
;
; Function Name:    _Zip_VirtualZipOpen()
; Description:      Delete a Virtual Zip.
; Parameter(s):     none.
; Requirement(s):   none.
; Return Value(s):  On Success - 0
;                   On Failure - none.
; Author(s):        torels_
; Notes:            none
;
;===============================================================================
Func _Zip_VirtualZipDelete($aVirtualZipHandle)
    For $i = 2 to UBound($aVirtualZipHandle)-1
        If FileExists($aVirtualZipHandle[1] & "\" & $aVirtualZipHandle[$i]) Then FileDelete($aVirtualZipHandle[1] & "\" & $aVirtualZipHandle[$i])
    Next
    Return 0
EndFunc

;===============================================================================
;
; Function Name:    _Zip_DllChk()
; Description:      Internal error handler.
; Parameter(s):     none.
; Requirement(s):   none.
; Return Value(s):  Failure - @extended = 1
; Author(s):        smashley
;
;===============================================================================
Func _Zip_DllChk()
    If Not FileExists(@SystemDir & "\zipfldr.dll") Then Return 2
    If Not RegRead("HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}", "") Then Return 3
    Return 0
EndFunc   ;==>_Zip_DllChk

;===============================================================================
;
; Function Name:    _GetIcon()
; Description:      Internal Function.
; Parameter(s):     $file - File form which to retrieve the icon
;                   $ReturnType - IconFile or IconID
; Requirement(s):   none.
; Return Value(s):  Icon Path/ID
; Author(s):        torels_
;
;===============================================================================
Func _GetIcon($file, $ReturnType = 0)
    $FileType = StringSplit($file, ".")
    $FileType = $FileType[UBound($FileType)-1]
    $FileParam = RegRead("HKEY_CLASSES_ROOT\." & $FileType, "")
    $DefaultIcon = RegRead("HKEY_CLASSES_ROOT\" & $FileParam & "\DefaultIcon", "")
    
    If Not @error Then
        $IconSplit = StringSplit($DefaultIcon, ",")
        ReDim $IconSplit[3]
        $Iconfile = $IconSplit[1]
        $IconID = $IconSplit[2]
    Else
        $Iconfile = @SystemDir & "\shell32.dll"
        $IconID = -219
    EndIf
    
    If $ReturnType = 0 Then
        Return $Iconfile
    Else
        Return $IconID
    EndIf
EndFunc

;===============================================================================
;
; Function Name:    _IsFullPath()
; Description:      Internal Function.
; Parameter(s):     $path - a zip path
; Requirement(s):   none.
; Return Value(s):  success - True.
;                   failure - False.
; Author(s):        torels_
;
;===============================================================================
Func _IsFullPath($path)
    if StringInStr($path,":\") then
        Return True
    Else
        Return False
    EndIf
Endfunc

;===============================================================================
;
; Function Name:    _Hide()
; Description:      Internal Function.
; Parameter(s):     none
; Requirement(s):   none.
; Return Value(s):  none.
; Author(s):        torels_
;
;===============================================================================
Func _Hide()
    If ControlGetHandle("[CLASS:#32770]", "", "[CLASS:SysAnimate32; INSTANCE:1]") <> "" And WinGetState("[CLASS:#32770]") <> @SW_HIDE   Then ;The Window Exists
        $hWnd = WinGetHandle("[CLASS:#32770]")
        WinSetState($hWnd, "", @SW_HIDE)
    EndIf
EndFunc

Used like this:

#include "Zip.au3"
Dim $Zip
$Zip = _Zip_Create(@DesktopDir & "\Subscribers\" & @MDay & "-" & @Mon & ".zip") ;Create The Zip File. Returns a Handle to the zip File
_Zip_AddFolderContents($Zip, @DesktopDir & "\Subscribers\Today") ;Add a folder's content in the zip file
Edited by Adrive

Share this post


Link to post
Share on other sites
Adrive

?

Share this post


Link to post
Share on other sites
Melba23

Adrive,

First, please do not bump your own posts within 24 hours. :mellow:

Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually.....as I am now. :party:

I have taken a closer look at the internals of Zip.au3 and found that you can remove the progress dialog by using the "Hide" flag in certain function calls. So you need to write your call like this:

_Zip_AddFolderContents($Zip, @DesktopDir & "\Subscribers\Today", 1)

Top Tip: Looking carefully at the function headers of UDFs is usually pretty essential so that you are aware of the various parameters available - the example scripts often do not use them all.

I trust that solves your problem. Thanks for the opportunity to investigate the UDF - I had not used it before. :P

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Adrive

First of all Thanks for the information about forum rules, i am really sorry for that.

in most forums bump rule is 12hrs. so i thought it's OK to bump the topic.

next time i 'll be careful.

i did as you said and now the dialog box windows is showed only for few seconds.

but it's not permanently removed. it's still there for a short time.

and i could not find any parameters to hide it fully.

any more help would be really appreciated.

Thanks

Share this post


Link to post
Share on other sites
Melba23

Adrive,

I get no progress dialog at all when I use the "Hide" parameter. So I cannot offer any other suggestions on how to remove it - sorry! :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
UEZ

_Hide() function from Zip.au3

Func _Hide()
    If ControlGetHandle("[CLASS:#32770]", "", "[CLASS:SysAnimate32; INSTANCE:1]") <> "" And WinGetState("[CLASS:#32770]") <> @SW_HIDE Then ;The Window Exists
    $hWnd = WinGetHandle("[CLASS:#32770]")
    WinSetState($hWnd, "", @SW_HIDE)
    EndIf
EndFunc

As I mentioned in post#4 it may be that your class id is different than checked in _Hide() function. You can check the class with the AutoIt v3 Window Info tool by pressing strg+F6 in SciTE and modifying the _Hide() function.

BR,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Melba23

UEZ,

Good point - I missed your earlier post. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Adrive

This time i tried with a big size file but it's still showing the whole process.

Window is still visible. please check the information which i got from that window.

and tell me what's wrong.

Here is the window information

Basic Window Info

Title: Compressing...

Class: #32770

Basic Control Info

Class: SysAnimate32

Instance: 1

Summary:

>>>> Window <<<<

Title: Compressing...

Class: #32770

Position: 30, 33

Size: 381, 162

Style: 0x94CA01CC

ExStyle: 0x00010101

Handle: 0x000103B0

>>>> Control <<<<

Class: SysAnimate32

Instance: 1

ClassnameNN: SysAnimate321

Advanced (Class): [CLASS:SysAnimate32; INSTANCE:1]

ID: 336

Text:

Position: 11, 0

Size: 272, 60

ControlClick Coords: 175, 56

Style: 0x5000000E

ExStyle: 0x00000004

Handle: 0x000103B2

>>>> Mouse <<<<

Position: 219, 111

Cursor ID: 2

Color: 0xF4F4F4

>>>> StatusBar <<<<

>>>> Visible Text <<<<

Breaking ,News ,video.flv

Cancel

>>>> Hidden Text <<<<

Share this post


Link to post
Share on other sites
trancexx

That window is a sort of a mystery. It's not clear why it's showing in AutoIt even if proper parameters to the function/method controlling it is set.

Considering I wasn't able to duplicate the behavior in some other languages it appears that something is wrong with AutoIt itself even though that sounds very far-fetch and impossible to prove. Very weird.

Btw, lose Zip.au3. that's one of the worst UDFs I've ever seen.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
Adrive

That window is a sort of a mystery. It's not clear why it's showing in AutoIt even if proper parameters to the function/method controlling it is set.

Considering I wasn't able to duplicate the behavior in some other languages it appears that something is wrong with AutoIt itself even though that sounds very far-fetch and impossible to prove. Very weird.

Btw, lose Zip.au3. that's one of the worst UDFs I've ever seen.

So, what should i do now?

is it a AutoIt Bug?

Share this post


Link to post
Share on other sites
SublimePorte

It's not an AutoIt bug, the UDF simply doesn't use the correct means to suppress the dialog.

The _Hide() function in this UDF is the wrong way to do this and doesn't seem to work consistently anyway.

;Instead of this:
$oCopy = $oApp.NameSpace($hZipFile).CopyHere($oFolder.Items)

;It should be like this:
$oCopy = $oApp.NameSpace($hZipFile).CopyHere($oFolder.Items, 4)

;To prevent the copy progress dialog showing

This option of the MS folder object's copyhere method is documented here.

Share this post


Link to post
Share on other sites
Adrive

@ SublimePorte

i changed the line as suggested, but the result is same as before.

the documentation which you provided, i have read that too.

now i am totally confused what to do.

any one please help if you can.

Share this post


Link to post
Share on other sites
Adrive

i added a little code in the function and now the Window is showed only for a very short time.

here is the function, changes are in Bold.

Func _Zip_AddFolderContents($hZipFile, $hFolder, $flag = 1)

Local $DLLChk = _Zip_DllChk()

If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll

If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path

If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file

If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\"

$files = _Zip_Count($hZipFile)

$oApp = ObjCreate("Shell.Application")

$oFolder = $oApp.NameSpace($hFolder)

$oCopy = $oApp.NameSpace($hZipFile).CopyHere($oFolder.Items, 1028)

$oFC = $oApp.NameSpace($hFolder).items.count

While 1

If WinExists("Compressing...") Then

WinSetState("Compressing...", "", @SW_HIDE)

EndIf

If $flag = 1 then _Hide()

If _Zip_Count($hZipFile) = ($files+$oFC) Then ExitLoop

Sleep(10)

WEnd

Return SetError(0,0,1)

EndFunc ;==>_Zip_AddFolderContents

But because it still shows the window for some time, i want it to be perfect.

i hope you guys 'll help me. i have already tried my best. even tried to change the _HIDE() Function in it.

Share this post


Link to post
Share on other sites
water

I use rasims ZIP32 UDF and it works fine for me.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
UEZ

You can try the ZIP.au3 from wraithdu!

BR,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
Adrive

Thanks for the alternatives but none of them have

Func _Zip_AddFolderContents()

how do i add contents of a folder to a zip file invisible mode?

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
Sign in to follow this  

×