Jump to content
Sign in to follow this  
Pelme666ko

read file from *.zip archive into variable

Recommended Posts

Pelme666ko

Hi! I have a zip file in which ~ 200,000 xml files to be read. The method of "unzip-read-delete" works very slowly. In theory, I can read the file from the archive without unpacking it to the HDD. I read all about it on the internet and found zlib.dll + example for BASIC.Can somebody help convert this example in autoit?

http://zalil.ru/34813667 - zlib.zip

I stopped at the function unzGetCurrentFileInfo(), and was not able to correctly call

$hZlib = DllOpen (@ScriptDir&'\zlib.dll')
#include <array.au3>

$zipfile=FileOpenDialog('zip',@ScriptDir,'ZIP-file(*.zip)')
$result = DllCall($hZlib, "long", "unzOpen", "str", $zipfile);возвращает 0 если нет ошибок
if @error Then
    MsgBox(0,'err',@error)
Else
    _ArrayDisplay($result,'open')
EndIf
$zHandle=$result[0]


$result = DllCall($hZlib, "long", "unzGoToFirstFile", "long", $zHandle);возвращает 0 если нет ошибок
if @error Then
    MsgBox(0,'err',@error)
Else
    _ArrayDisplay($result,'first')
EndIf

local $pfile_info
Local $szFileName
Local $fileNameBufferSize=260
Local $extraField=0
Local $extraFieldBufferSize=0
local $szComment
local $commentBufferSize=0
$result = DllCall($hZlib, "long", "unzGetCurrentFileInfo", _
                        'long', $zHandle, _         ;ByVal file As Long
                        'unz_file_info', $pfile_info, _     ;pfile_info As unz_file_info
                        'str', $szFileName, _           ;ByVal szFileName As String
                        'long', $fileNameBufferSize, _      ;ByVal fileNameBufferSize As Long
                        'long', $extraField, _          ;extraField As Any
                        'long', $extraFieldBufferSize, _    ;ByVal extraFieldBufferSize As Long
                        'str', $szComment, _            ;ByVal szComment As String
                        'long', $commentBufferSize)     ;ByVal commentBufferSize As Long

if @error Then
    MsgBox(0,'err',@error)
Else
    _ArrayDisplay($result,'info')
EndIf


DllCall($hZlib, "long", "unzClose", "long", $zipfile)
if @error Then
    MsgBox(0,0,@error)
EndIf
DllClose($hZlib)

I'm sorry for my english)

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  

×