Sample code for 30+ languages & platforms
AutoIt

Compress Bytes

See more Compression Examples

Demonstrates how to compress binary data.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

;  This example assumes the Chilkat API to have been previously unlocked.
;  See Global Unlock Sample for sample code.

$oFac = ObjCreate("Chilkat.FileAccess")

Local $oFileBytes
$oFileBytes = $oFac.ReadEntireFile("qa_data/bmp/big.bmp")
If ($oFac.LastMethodSuccess <> True) Then
    ConsoleWrite($oFac.LastErrorText & @CRLF)
    Exit
EndIf

$oCompress = ObjCreate("Chilkat.Compression")
$oCompress.Algorithm = "deflate"

Local $oCompressedBytes
$oCompressedBytes = $oCompress.CompressBytes($oFileBytes)
If ($oCompress.LastMethodSuccess <> True) Then
    ConsoleWrite($oCompress.LastErrorText & @CRLF)
    Exit
EndIf

$bSuccess = $oFac.WriteEntireFile("qa_output/compressedBmp.dat",$oCompressedBytes)
If ($oFac.LastMethodSuccess <> True) Then
    ConsoleWrite($oFac.LastErrorText & @CRLF)
    Exit
EndIf