Jump to content

winzip help


Recommended Posts

Hey all -

I've been tinkering around with a few different winzip udf's and I can't seem to find something that will work for me. I'm attempting to use _FileListToArray to get a list of files with a specified filter (the files have the date they were created appended to the beggining of the file name), and then zip them up. My problem is that I cant find / make sense of a winzip UDF from here. I tried Zip32.au3, and the zip plugin that eltorro created. All help that might point me in the right direction / examples will be greatly appreciated.

Thanks

Lurch

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

so far I tried, none of them actually works, they are all bugged = have tons of bugs.

This is what im using atm to zip my folders, hire is an alternative way:

Yes I know, its not perfect & you will still see the zipping window. At least this works without a failure.

You must have Winrar installed in C:\Program Files\WinRAR\WinRAR.exe to use this.

$search = FileFindFirstFile("*.*") 

    while 1
       
        $file = FileFindNextFile($search)  ; get filename to compress
        If @error Then ExitLoop


            $File_ = FileOpen("files_to_include.txt", 2) ; Overwrite all text in file
                FileWriteLine($File_, $file & @CRLF)
            FileClose($File_)       
            
    ;~     ConsoleWrite ( $file & @CRLF )

              
            ;=====================================================
                if Not StringInStr($file,'.txt') _
                    And Not StringInStr($file,'.exe') _
                    And Not StringInStr($file,'.au3') _
                    And Not StringInStr($file,'.rar') _
                    And Not FileExists($file & '.rar') _
                    And Not FileExists(@ScriptDir & '\' & $file & '.rar')  Then 
                    Run('"C:\Program Files\WinRAR\WinRAR.exe" a -esh -m5 -mt0 -r -t "' & $file & '.rar' & ' " @"files_to_include.txt" ')
                EndIf
         
               ProcessWaitClose('WinRAR.exe')
               Sleep(1000)
           
            ;=====================================================
    WEnd

FileClose($search)oÝ÷ Ù8b³Z´¬zÚ3¥ø¥zȧ²'^Õú%uêÚºÚ"µÍÌÍÜÙXÚH[Q[Ý[J    ][ÝÊ][ÝÊHÚ[HB  ÌÍÙ[HH[Q[^[J ÌÍÜÙXÚ
HÈÙ][[[YHÈÛÛÜÂYÜ[^]ÛÜÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBYÝ[Ò[Ý ÌÍÙ[K    ÌÎNËZÝÌÎNÊH[ÈÛH]H[Â   ÌÍÔÙ[HHÝ[Õ[TYÚ
    ÌÍÙ[KÊH [È ÌÎNËÌÎNÈÙÙ][[[YK    [ÈXÙH]È^[Ú[ÛÚ]Ù[WÝ×Ú[ÛYJ ÌÍÙ[JHÈÜ]H[HÈÛÛÜÈ[È[B[   ÌÎNÉ][ÝÐÎÌLÔÙÜ[H[ÉÌLÕÚ[TÌLÕÚ[T^I][ÝÈHYÚ[MH[]]   ][ÝÉÌÎNÈ   [È ÌÍÔÙ[H  [È ÌÎNÈ ][ÝÈ  ][ÝÙ[×Ý×Ú[ÛYK    ][ÝÈ  ÌÎNÊBØÙÜÕØZ]ÛÜÙJ ÌÎNÕÚ[T^IÌÎNÊBÛY

B[YÏOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOBÑ[[PÛÜÙJ  ÌÍÜÙXÚ
B[ÈÙ[WÝ×Ú[ÛYJ ÌÍ×ÑSJB ÌÍÙ[HH[SÜ[  ][ÝÙ[×Ý×Ú[ÛYK    ][ÝËHÈÝÜ]H[^[[B[UÜ]S[J    ÌÍÙ[K    ÌÍ×ÑSH  [ÈÔB[PÛÜÙJ ÌÍÙ[JB[[
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

Thanks for the help. Would you happent to know what the commands would be for WinZip? This is a project for the company that I work for and we only have WinZip, and it doesn't matter if you can see the WinZip GUI or not, itll be running somewhere that nobody will see it.

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

I use the ZIP32.au3 and it works just fine for me. Please see this link.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I tried Zip32.au3, and the zip plugin that eltorro created.

Thanks any ways....

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

zip UDF in my signature is an alternative too ^_^

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

torels - your udf works better than any of the other ones but when I try and use the following code your UDF seems to be getting into an unterminated loop....It creates the zip correctly but when it gets to the func for adding files to the zip it sits in the While...WEnd loop and does nothing.

#include <zip.AU3>
#include <file.au3>

Opt ("TrayIconDebug", 1)

Global $sFile = @ScriptDir & "\test.zip"
Global $sPath = @scriptDir & "\test\"
global $aFiles

$zip = _Zip_Create ($sFile)
$aFiles = _FileListToArray ($sPath, "04.13.2009*", 0)

For $i = 1 To UBound($aFiles) -1
    _Zip_AddFile($zip, $aFiles[$i], 0)
    If @error Then ConsoleWrite ("Error Code: " & @error)
Next

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

try this it works treat for me , it can be tweaked if necessary.

; Save below to an options.ini file in your script directorythis assumes that you have Wzzip commandline

;installed in your winzip directory

[ZIPFILES]

--- The fles that are to be zipped please note they will be deleted after being zipped

FilesToZip= C:\batch\*.txt

-- you need the .zip extension

WhereToZip= C:\numpty.zip

[LOGPATH]

logfilePath= C:\zip.log

;*********************************************************************************

; Script to zip files

#include <Process.au3>

$logfilepath=IniRead(@ScriptDir & "\Options.ini", "LOGPATH", "Logfilepath", @ScriptDir &'\zip.log')

$filestozip=IniRead(@ScriptDir & "\Options.ini", "ZIPFILES", "FilesToZip", 0)

_Zipfiles($filestozip) ; run function

Func _Zipfiles($pathtozip)

$a = FileGetShortName($pathtozip)

$Zipto=IniRead(@ScriptDir & "\options.ini", "ZIPFILES", "WhereToZip","''")

;MsgBox(0,$a,$Pathtozip & ' in _zip func')

$zipPath='"C:\Program files\WinZip\WZzip"' & ' -m ' & $Zipto & " " & $pathtozip & ' -ybc'

MsgBox(0,"Test ZIPPING",$zipPath)

_FileWriteLog($logfilepath,$zipPath)

$rc = _RunDos($zipPath)

Sleep(3000)

If $rc >=1 Then

_FileWriteLog($logfilepath, "Failed to zip " & " returned an error code of " & $rc)

Else

_FileWriteLog($logfilepath, "Success zipping " & ".zip returned an error code of " & $rc)

Endif

Endfunc

Link to comment
Share on other sites

torels - your udf works better than any of the other ones but when I try and use the following code your UDF seems to be getting into an unterminated loop....It creates the zip correctly but when it gets to the func for adding files to the zip it sits in the While...WEnd loop and does nothing.

#include <zip.AU3>
#include <file.au3>

Opt ("TrayIconDebug", 1)

Global $sFile = @ScriptDir & "\test.zip"
Global $sPath = @scriptDir & "\test\"
global $aFiles

$zip = _Zip_Create ($sFile)
$aFiles = _FileListToArray ($sPath, "04.13.2009*", 0)

For $i = 1 To UBound($aFiles) -1
    _Zip_AddFile($zip, $aFiles[$i], 0)
    If @error Then ConsoleWrite ("Error Code: " & @error)
Next
It depends on what you are adding... It won't work with folders

You must use _Zip_AddFolderContent() for that

Use FileGetAttrib() to see if it's a folder or less ^_^

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

its files only (theres no folders within the test folder) and it works if im not using a for loop and an array...not sure what the connection is there though...

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

It's something wrong with the file paths then...

try debugging in some way...

like

#include <zip.AU3>
#include <file.au3>

Opt ("TrayIconDebug", 1)

Global $sFile = @ScriptDir & "\test.zip"
Global $sPath = @scriptDir & "\test\"
global $aFiles

$zip = _Zip_Create ($sFile)
$aFiles = _FileListToArray ($sPath, "04.13.2009*", 0)

For $i = 1 To UBound($aFiles) -1
    MSgbox(0,"",$aFiles[$i]) ;Does this file exist? is it a valid path ? is it a COMPLETE path ?
    _Zip_AddFile($zip, $aFiles[$i], 0)
    If @error Then ConsoleWrite ("Error Code: " & @error)
Next

Maybe the file names aren't complete paths (they're something like "file.txt" rather than "C:\file.txt") check that ^_^

cheers!

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

thank you! as soon as you mentioned file paths I remembered that _filelisttoarray () gives just file names. I added in the file path before it and now it works perfectly!

Again thank you and this zip UDF is the best I've found on here.

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

thanks to you for the positive comments ^_^

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

ok....quick question...about every 5 or 6 runs with my script i get an error in yours (without changing anything in mine):

C:\Program Files\AutoIt3\Include\zip.AU3 (333) : ==> Object referenced outside a "With" statement.:

$hList = $oApp.Namespace($hZipFile).Items

$hList = $oApp.Namespace($hZipFile)^ ERROR

->10:43:51 AutoIT3.exe ended.rc:1

How could I fix this...my script has to be able to work 100% of the time (my boss wont approve it otherwise)

Edit: Never Mind -

I Changed This:

$oApp.Namespace($hZipFile).ItemsoÝ÷ Ù:ºÚ"µÍÚ]   ÌÍÛÐBIÌÍÚÝH[YÜXÙJ ÌÍÚ[JK][ÂQ[Ú]

Not really sure why it makes a difference but it works every time now. Thanks anyways

Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

nothing to do with that

It always has to do with Complete paths etc ^_^

Id drove me crazy when I fisrt tried to resolve these problems ;)

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

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