Jump to content

ZIP.au3 UDF in pure AutoIt


torels
 Share

Recommended Posts

Is very strange that if you have the flags for CopyHere method set as 4 ( to not show the compressing dialog will ) not work but in my case ( both on w7 and xp sp3 ) when i use 0x4 instead of 4 works even if 0x4 is practically the same as 4 or even 04 ( octal ) . And even more strange is that when you are not copying to a zip folder both 4 and 0x4 work .

I searched a lot for a method to suppress the dialog cause _hiding with SW_HIDE is ugly and there are chances to show the dialog for a very short time , the eye can see the window even if the window is present just for 30 milliseconds .

I hope this might help others , cause there are other ways to suppress the dialog but they imply much more coding and knowledge and they are cumbersome .

Edited by Azraelsub7
Link to comment
Share on other sites

  • Moderators

Azraelsub7,

wraithdu has completely rewritten this UDF here - responders went into some detail about why this happens and possible solutions. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

@Melba23

Yeah i know i read this and that thread a thousand times , still flags don't work , using either 20 or 4 will still show the dialog on my machines , using 0x4 instead will not display compressing dialog , and that is very weird .

You should try it , maybe is the same for you , anyway i use my own udf for zipping with the same method ( shell object ) ( cause this is the only way using windows build in features ) , but i do not need much of the functionality that is present here .

I saw that some said that dialog comes from zipfldr.dll but i don't think that is correct as MS programs usually store dialogs in resources , and on both w7 and xp , zipfldr.dll has no dialogs in resources .

There are other threads in witch users complain that flags don't work , as i said i did a lot of searches but thanks greatly for your good intention .

Link to comment
Share on other sites

  • 4 weeks later...

Okay so I'm trying this:

_Zip_UnzipAll("tempdownload\" & $downloadfile & ".zip", "tempdownload\" & $downloadfile & "\")

And it isn't giving any errors or anything but it isn't extracting anything for me, any ideas?

I already checked and the $downloadfile part is all good and well, no problems there

I have no idea what "flags" I may need to use, I haven't found them listed anywhere =S

Link to comment
Share on other sites

  • 5 months later...
  • 3 months later...

You should check in your _Zip_AddXXXX if the file/folder to add exist (if not, actualy, the script pause indefinitively)

_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).
Link to comment
Share on other sites

  • 2 months later...

Hi,

I have installed the UDF library.

I have a problem, I want to extract the file natives.zip(it is located in %APPDATA%.extremecraft)to the %APPDATA%.extremecraftnatives

Please correct my function.

_Zip_UnzipAll($natives, @AppDataDir & ".extremecraftnatives")

Thank you.

Edited by mamutos99
Link to comment
Share on other sites

  • 6 months later...
  • 9 months later...

i used this udf and i didnt get an error code but it didnt work

#include <zip.au3>
$hFolder = "D:7z-shell"
$hZipFile = "@AppDataDir & 'hello.zip'"
$flag = '1'
_Zip_AddFolderContents($hZipFile, $hFolder, $flag = 1)

 

"D:7z-shell" isn't a valid path. You probably ment "D:7z-shell"

Edited by garbb
Link to comment
Share on other sites

I noticed that I was getting an error intermittently when adding a bunch of files to a zip file using the _Zip_AddFolderContents function. The error is in the _Zip_List() function on the $oApp.Namespace($hZipFile).Items line. Basically I think that $oApp.Namespace($hZipFile) was sometimes not returning an object because the _Zip_AddFolderContents function is trying to write to the zip file and read the contents of the zip file at the same time. I modified Zip.au3 slightly so that the error is a COM error instead of an autoit3 error and added a COM error handler so that at least the script will run fully instead of exiting out when the error happens. I know this is not a proper fix but it was the only thing I could come up with to make it work...

Zip.au3

Link to comment
Share on other sites

  • 3 weeks later...

I get the following error when I use zip.au3 and console.au3 together.  To simulate this error please create a new script in SciTE script editor and include zip.au3 and console.au3 and then run it.  You will get two pop up messages.

Here are the error messages:

First Popup message:

AutoIt Error: 

Line 456 (File "C:Program Files (z86)|AutoIt3Includezip.au3:):

$ZipFile=#ZipSplit[2]
$ZipFile=^Error

Error:  Array variable has incorrect number of subscripts or subscript dimension range exceeded.

Second popup message:

Line 455 (File "C:Program Files (z86)|AutoIt3IncludeConsole.au3:):

If $_Amount_Startup_COnsole Then If^Error

Error:  Variable used without being declared.

Link to comment
Share on other sites

  • 4 months later...

On Windows 7 x64 the _Hide() function does not work.

This is the fix for it.

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

Just change the SysAnimate32 to DirectUIHWND

Edited by ScriptingNewbie
Link to comment
Share on other sites

  • 1 month later...

Hey,

I can't really get the progressbar away. If I use the flag as 1 or not, doesnt work. The progressbar is still there. I really want to unzip quietly. :)

#include <Zip.au3>
$filepath = "test.zip"
$pathtosavethefileat = "c:\temp"
_Zip_UnzipAll($filepath, $pathtosavethefileat, 1)

Should I do something else to make it work? Is anyone else having this problem?

--- EDIT---

I'm using Windows 7 x64 and tried to use the "new" hide function above. 

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

Unfortunately that didn't work. 

 

/Fredricz

Edited by Fredricz
Link to comment
Share on other sites

  • Moderators

Fredricz,

If you read my post at the top of this page you will find the answer - which unfortunately is not what you want to hear. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • 4 months later...

I know this is an old post, but is there any way to exclude specific files that contain certain strings.  For example if I zip a folder called test that has files named 1-5 in it can I exclude the file named 4 or with 4 in its name.

Link to comment
Share on other sites

  • 1 year later...

 Hi,

I am using your script and I'm wondering about the return value of _Zip_AddFile. When I'm using an absolute path with no trailing "/" or "\", your function returns 1, but perfectly creates a file in the zip directory. When I'm adding the "/" or "\" i get no error (0), but nothing is added.

What am I doing wrong?

I added a snippet of my code. Excuse me for my coding-style, which is no Autoit-standard. :)

Func FileCopyToZipLog($name, $prefix, $sourceFile)
   $zipDir = $DIR_LOGFILES & $name & ".zip"
   $dir = $DIR_LOGFILES

   If Not FileExists($zipDir) Then
      _Zip_Create($zipDir)
   EndIf

   $filename =  $dir & $prefix & @MDAY & "." & @MON & "." & @YEAR & "_" & @HOUR & "h" & @MIN & "m" & @SEC & "s" & ".txt"

   FileCopy($sourceFile, $filename)
   $success = _Zip_AddFile($zipDir, $filename)
   MsgBox(0, "Return Value", $success)

   FileDelete($filename)
EndFunc

 

 

Edited by Marvin_Baral
inserted code
Link to comment
Share on other sites

  • 2 months later...

I an trying to unzip a file using

_Zip_UnzipAll("C:\Users\Brodie\AppData\Local\Temp\NewInstall\MSIAfterBurner.zip", "C:\Users\Brodie\AppData\Local\Temp\NewInstall",[1])

and I get 

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Brodie\Desktop\Install\NewInstall.au3"    
"C:\Users\Brodie\Desktop\Install\NewInstall.au3" (269) : ==> Error in expression.:
_Zip_UnzipAll("C:\Users\Brodie\AppData\Local\Temp\NewInstall\MSIAfterBurner.zip", "C:\Users\Brodie\AppData\Local\Temp\NewInstall",[1])
_Zip_UnzipAll("C:\Users\Brodie\AppData\Local\Temp\NewInstall\MSIAfterBurner.zip", "C:\Users\Brodie\AppData\Local\Temp\NewInstall",^ ERROR
>Exit code: 1    Time: 1.003

Thanks for any help! 

Screenshot attached showing the file is there.

Capture.JPG

Edited by esullivan
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...