Jump to content

Easy Zip Compression using Windows XP


mozart90
 Share

Recommended Posts

I have a question regarding the "wait for finish" of zip process!

When you add a huge file / folder to a zip file using the internal zip (as posted in previous posts), how do you know when the file / folder to zip is finished?

As far as I know you need to wait in a loop until the zip process is ended otherwise it will be interrupted!

Here a snippet:

...

$obj_Copy = $obj_ZIP.NameSpace($zip_filename).CopyHere($obj_Folder.Items, $flag) ;add files to ZIP archive

While 1

If $obj_Copy has finished Then ExitLoop ;not AutoIt syntax

WEnd

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Replies 77
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I have a question regarding the "wait for finish" of zip process!

When you add a huge file / folder to a zip file using the internal zip (as posted in previous posts), how do you know when the file / folder to zip is finished?

As far as I know you need to wait in a loop until the zip process is ended otherwise it will be interrupted!

Here a snippet:

...

$obj_Copy = $obj_ZIP.NameSpace($zip_filename).CopyHere($obj_Folder.Items, $flag) ;add files to ZIP archive

While 1

If $obj_Copy has finished Then ExitLoop ;not AutoIt syntax

WEnd

UEZ

I'm not an expert on this by any means, and I have never thrown a huge file at _ZipAdd, though I have done some largish ones on occasion. I always incorporate a Splash Screen during the process, and if I remember rightly, the splash stays visible a little longer, so I think you may have no problem. However, if you have posted because you did have a problem, then obviously I'm talking out of my arse. The PsaltyDS or one of the other contributors might have a better idea than me ... I just use it.

If you haven't yet tested your issue, maybe download my Create Zip Within program from here, and see if you can rush the program with sizeable folder content, and maybe end up with a failed zip.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I'm not an expert on this by any means, and I have never thrown a huge file at _ZipAdd, though I have done some largish ones on occasion. I always incorporate a Splash Screen during the process, and if I remember rightly, the splash stays visible a little longer, so I think you may have no problem. However, if you have posted because you did have a problem, then obviously I'm talking out of my arse. The PsaltyDS or one of the other contributors might have a better idea than me ... I just use it.

If you haven't yet tested your issue, maybe download my Create Zip Within program from here, and see if you can rush the program with sizeable folder content, and maybe end up with a failed zip.

Currently I haven't a 100% solution but my idea was to check the thread which creates the zip file. Look here. During my tests it didn't exit the loop because thread count before wasn't equal with after zip task.

Checking file access isn't also not working 100%.

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I have a question regarding the "wait for finish" of zip process!

When you add a huge file / folder to a zip file using the internal zip (as posted in previous posts), how do you know when the file / folder to zip is finished?

As far as I know you need to wait in a loop until the zip process is ended otherwise it will be interrupted!

Here a snippet:

...

$obj_Copy = $obj_ZIP.NameSpace($zip_filename).CopyHere($obj_Folder.Items, $flag) ;add files to ZIP archive

While 1

If $obj_Copy has finished Then ExitLoop ;not AutoIt syntax

WEnd

UEZ

You count hte files in the zip file

when there are theoldfiles+1 then the file has been added

go take a look at my udf!

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

Currently I haven't a 100% solution but my idea was to check the thread which creates the zip file. Look here. During my tests it didn't exit the loop because thread count before wasn't equal with after zip task.

Checking file access isn't also not working 100%.

UEZ

What you've done there, looks pretty good. I don't know if I can help, but I'll take a look when I can.

You may want to check out Torels zip UDF, it is a lot more current than the one here, and he's probably catered for what your asking. I think he's saying something along those lines anyway. :)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

You count hte files in the zip file

when there are theoldfiles+1 then the file has been added

go take a look at my udf!

I tried to understand your code already and asked you a question to understand the functionality of the zip function:

$obj_Copy = $obj_ZIP.NameSpace($zip_filename).CopyHere($obj_Folder.Items, $flag) <- this will start to add a folder to a zip file in the backround.

You can check the object $obj_Copy as long as it is running in the backround but when it is finished then your check will not work anymore (see bold line below).

Just an example from your code:

...

$files = _Zip_Count($hZipFile)

$oApp = ObjCreate("Shell.Application")

$oFolder = $oApp.NameSpace($hFolder)

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

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

While 1

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

WEnd

...

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

...

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

I made some test and the access to the object (shell application) worked as long as the zip thread is running in the backround. When it is finished you will get an error message like ...Object referenced outside a "With" statement...

Maybe I'm to stupid to understand :) or thinking to much complicated...

You can say why don't you use my udf and ask silly questions but I want to understand how it is working...

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I test it on my Vista x32:

#include <Zip.au3> ;[b]torels' UDF[/b]
Global $zip_file = "c:\Test.zip"
Global $source_folder = "C:\Windows\Inf\"
_Zip_Create($zip_file)
_Zip_AddFolder($zip_file , $source_folder )oÝ÷ ØȦ·¬°^méÛº+pYlµªí¶vØ^~]z»hk8©j·!÷¿»öÛºÜ!z{ayìmz¹ÚØky§ajǧuçméÈÂ)e­ç÷­+¢Z+¡÷ôÓM,¥©ì·)^

is is working properly!

I think I found why I get the error -> $zip = _Zip_Create($zip_file). I need a filehandle...

1 step closer... maybe I will understand now :)

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

I test it on my Vista x32:

#include <Zip.au3> ;[b]torels' UDF[/b]
Global $zip_file = "c:\Test.zip"
Global $source_folder = "C:\Windows\Inf\"
_Zip_Create($zip_file)
_Zip_AddFolder($zip_file , $source_folder )oÝ÷ ØȦ·¬°^méÛº+pYlµªí¶vØ^~]z»hk8©j·!÷¿»öÛºÜ!z{ayìmz¹ÚØky§ajǧuçméÈÂ)e­ç÷­+¢Z+¡÷ôÓM,¥©ì·)^

is is working properly!

I think I found why I get the error -> $zip = _Zip_Create($zip_file). I need a filehandle...

1 step closer... maybe I will understand now o:)

UEZ

yes... it should be supposedf to work with the first method to... I'll check that tonight when I get home :)

Anyway... new release coming out :)

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

  • 1 year later...

This is truly cool. Will this be added to the Ultimate Scripts or similar?

Did you notice this topic is almost two years old? What did you mean by "Ultimate Scripts"?

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 2 weeks later...

Did you notice this topic is almost two years old? What did you mean by "Ultimate Scripts"?

;)

Dear Most Venerable Penguin

I downloaded a file called 'Ultimate AutoIt Scripts Collection' which is very cool.

This is the Readme:

This is a compilation of AutoIt scripts created by the members on the forum.

Included so far:

1>Woods Mini Web Server (nfwu)

2>BenEditor(AutoItKing)

3>Sliding Launcher Toolbar(Valuater, Simucal, AutoItKing)

4>Yahtzee(th.meger)

5>Analog Clock(greenmachine,Credit - Larry (region funcs), neogia (anti-flicker, erasing old lines), Valuater (tray, transparency)

6>InvertorGame (James Bench)

7>Marfdaman's Mediaplayer(marfdaman)

8>AutoIt-123(Valuater)

9>Internet Explorer Automation UDF Library and IE-Builder for AutoIt3(Dale Hohm)

10>Emailer(JdeB and AutoItKing)

11>Small Downloader (Felix N.)

12>ProPlayer (npam)

So I figured that something as cool as this should be added to something as cool as the Ultimate Scripts Collection. Good things never go old ;-)

Does the answer of the newbie satisfy the master?

Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

A link would have been more helpful, but I found it anyway: The best scripts I also note the last post in that topic was March 2007.

Unfortunately, good things DO get old (at least in the IT world). Great scripts cease to be great when they don't work with the current version anymore. As a compilation, it would have to be kept up to date or it becomes actually harmful.

For example, Dale Hohm's IE.au3 UDF has been part of AutoIt's standard distribution for years, and Valuater's AutoIt 1-2-3 tutorial is maintained in a topic where the latest version is always available. Are the versions you get from this collection that up to date?

This post by the originator of the "Ultimate Scripts" collection is particularly instructive (remember it's from 2007):

That "guy" is me. And I fixed that a while ago, but not in here though.

Actually, it'd be nice if someone else took this over for me. (the collection, not beneditor)I got a lot of other stuff to do.

Like web mastering, graphics design, school, etc.

I don't have that much time on my hands.

And I'm not up for devising a huge management operation for this thing.

So... any takers?

There were no takers.

;)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

Skysnake ,

If you want to zip using the Windows zipfldr.dll library within AutoIt I would heartily recommend wraithdu's new Zip UDF. ;)

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

  • 2 years later...

I just realised that the post I was replying to a post from 2006 so what about to post and my last post may be irrelevant. Also instead of the input box for selecting the zip, use

FileSaveDialog("Create Zip File","","PK-Zip(*.zip)|All(*.*)",0,"New Compressed (zipped) Folder.zip")

It makes it a little more user friendly.

Link to comment
Share on other sites

Not to mention there is a newer UDF available by wraithdu.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

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...