Jump to content
Sign in to follow this  
SoftVoile

error creating a Zip file

Recommended Posts

SoftVoile

hi, please help me in creating a zip file with some files using autoit script.

script:

$ZipArchive = @ScriptDir & "\tmp.zip"; Put here the full path and name ame of archive you would like to create
$AddFile = @ScriptDir & "\ff.au3";; Put here the the File you would like to compress in the zip   
$AddFile2 = @ScriptDir & "\sss_4.au3"; Take another File ...


$oShell = ObjCreate("Shell.Application"); Create s shell Object

if IsObj($oShell) then             
    InitZip($ZipArchive); Create an emtpy zip file with header   
    $oDir = $oShell.NameSpace($ZipArchive); Use the zip file as an "Folder"
    $oDir.CopyHere ($AddFile); Copy a file in the "Zip Folder"
    $oDir.CopyHere ($AddFile2); Copy a second file
    sleep (500); Give the Objekt a litte bit time to work
else
    Msgbox (0,"Error","Error creating Object.")
endif

Error:

Posted Image


Unresolved topics:1- Please help me in Editing or replacing a page in FireFox and IE.Please have a look at them.

Share this post


Link to post
Share on other sites
funkey

$ZipArchive = @ScriptDir & "\tmp.zip"; Put here the full path and name ame of archive you would like to create

$AddFile = @ScriptDir & "\ff.au3";; Put here the the File you would like to compress in the zip   
$AddFile2 = @ScriptDir & "\sss_4.au3"; Take another File ...


$oShell = ObjCreate("Shell.Application"); Create s shell Object

if IsObj($oShell) then           
    InitZip($ZipArchive); Create an emtpy zip file with header   
    $oDir = $oShell.NameSpace($ZipArchive); Use the zip file as an "Folder"
    $oDir.CopyHere ($AddFile); Copy a file in the "Zip Folder"
    $oDir.CopyHere ($AddFile2); Copy a second file
    sleep (500); Give the Objekt a litte bit time to work
else
    Msgbox (0,"Error","Error creating Object.")
endif


Func InitZip ($zip_path_name)
    $bin_zipString = Binary("0x504B0506000000000000000000000000000000000000")
    $file = FileOpen($zip_path_name,2 + 16); binary mode                 
    FileWrite($file,$bin_zipString);Write the binary in a file
    FileClose($file)
EndFunc


Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
torels

the way you are adding files is not very efficient in case of big files

go and take a look at my UDF for some examples :)


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

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  

×