(AutoIt) Append String as a File to a Zip
Demonstrates how to append text data as a file within a zip archive.
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oZip = ObjCreate("Chilkat.Zip")
Local $bSuccess
Local $sZipPath = "c:/temp/test.zip"
; Initialize the zip object, which also sets the FileName property to the path of the zip to be created.
$oZip.NewZip($sZipPath)
; Append a file that will contain the string "Hello World";
Local $sFileContent = "Hello World"
Local $sPathInZip = "txtFiles/helloWorld.txt"
Local $oEntry = $oZip.AppendString($sPathInZip,$sFileContent)
$oZip.FileName = $sZipPath
$bSuccess = $oZip.WriteZipAndClose()
If ($bSuccess = False) Then
ConsoleWrite($oZip.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Success." & @CRLF)
|