Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Pomoc] Pobieranie Folderów/Wszystkich plików


Panth

Rekomendowane odpowiedzi

Opublikowano

Witam.

 

Mógłby mi ktoś pomóc? Mianowicie robię własny patcher i chciałbym aby pobierał on wszystkie pliki/ foldery z danej strony.

 

Np. Na stronie patcher.pantheons.pl/ posiadam różne foldery i pliki. To jak zrobić żeby on mi je wszystkie naraz pobierał.

 

O to Source

 

http://wklej.to/mNJnr

 

#NoTrayIcon
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Users\user\Desktop\autoit\launcher\Regulamin.kxf
$Regulamin = GUICreate("Regulamin", 659, 291, 297, 125)
GUISetFont(10, 400, 0, "Verdana")
GUISetBkColor(0x000000)
$Akceptuje = GUICtrlCreateButton("Akceptuję Regulamin Serwera Pantheons", 8, 256, 641, 25)
$Pantheons = GUICtrlCreateLabel("Pantheons", 256, 16, 140, 44)
GUICtrlSetFont(-1, 22, 400, 0, "Comic Sans MS")
GUICtrlSetColor(-1, 0xFF0000)
$Label1 = GUICtrlCreateLabel("1. Na Serwerze obowiązuje całkowity zakaz używania wspomagaczy/cheatów .", 16, 104, 528, 20)
GUICtrlSetColor(-1, 0xC0C0C0)
$Label2 = GUICtrlCreateLabel("2. Na Serwerze zabrania się używania słów wulgarnych/obraźliwych wobec drugiej osoby .", 16, 128, 602, 20)
GUICtrlSetColor(-1, 0xC0C0C0)
$Label3 = GUICtrlCreateLabel("3. Na Serwerze obowiązuje zakaz używania jakich kolwiek błędów w klientowych/serwerowych .", 16, 152, 639, 20)
GUICtrlSetColor(-1, 0xC0C0C0)
$Label4 = GUICtrlCreateLabel("4. Na Serwerze zabrania się graczom podawania za członków administracji .", 16, 176, 505, 20)
GUICtrlSetColor(-1, 0xC0C0C0)
$Label5 = GUICtrlCreateLabel("5. Na Serwerze zabrania się grozić graczom w życiu realnym (Real Life)", 16, 200, 475, 20)
GUICtrlSetColor(-1, 0xC0C0C0)
GUISetState(@SW_SHOW,$Regulamin)
#EndRegion ### END Koda GUI section ###


#Region ### START Koda GUI section ### Form=D:\Dawid\Pantheons\Launcher\Launcher.kxf
$Pantheons = GUICreate("Pantheons ~ Client 2012", 500, 78, 274, 267)
$Start = GUICtrlCreateButton("Start", 8, 16, 89, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Aktualizacja = GUICtrlCreateButton("Aktualizacja", 104, 16, 89, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Ustawienia = GUICtrlCreateButton("Ustawienia", 200, 16, 89, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Dodatki_Button = GUICtrlCreateButton("Dodatki", 296, 16, 89, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Wyjscie = GUICtrlCreateButton("Wyjście", 392, 16, 89, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$pasek_ladowania = GUICtrlCreateProgress(8, 48, 473, 17)
GUISetState(@SW_HIDE,$Pantheons)
#EndRegion ### END Koda GUI section ###


#Region ### START Koda GUI section ### Form=c:\users\user\desktop\autoit\launcher\dodatki.kxf
$Dodatki = GUICreate("Dodatki ~ 2012", 227, 267, 338, 134)
GUISetFont(9, 400, 0, "Verdana")
$Strona = GUICtrlCreateButton("Strona", 8, 32, 81, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Rejestracja = GUICtrlCreateButton("Rejestracja", 8, 64, 81, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Sklep = GUICtrlCreateButton("Sklep", 8, 96, 81, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Forum = GUICtrlCreateButton("Forum", 8, 128, 81, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Event_Shop = GUICtrlCreateButton("Event Shop", 8, 160, 81, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Event_list = GUICtrlCreateButton("Event List", 8, 192, 81, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Dodatki_HTTP = GUICtrlCreateLabel("Dodatki HTTP", 8, 8, 87, 18)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Dodatki_Gry = GUICtrlCreateLabel("Dodatki Gry", 136, 8, 77, 18)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Wersja_Gry = GUICtrlCreateButton("Wersja Gry", 136, 32, 81, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Wyjdz_Dodatki = GUICtrlCreateButton("Wyjdź z Dodatków", 8, 240, 209, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
GUISetState(@SW_HIDE,$Dodatki)
#EndRegion ### END Koda GUI section ###

#Region ### START Koda GUI section ### Form=c:\users\user\desktop\autoit\launcher\wersja_gry_gui.kxf
$Wersja_Gry_GUI = GUICreate("Wersja Gry", 208, 144, 244, 149)
$Label1 = GUICtrlCreateLabel("Wersja Gry: v1.0", 40, 40, 110, 18)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
$Zakoncz = GUICtrlCreateButton("Zakończ", 40, 104, 113, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
GUISetState(@SW_HIDE,$Wersja_Gry_GUI)
#EndRegion ### END Koda GUI section ###

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
       Case $Start
           $hshield = Run("hshield/security_pantheons.exe")
           If $hshield Then
               Sleep(1750)
               Run("metin2client.bin")
               Exit
           Else
               MsgBox(0, "Niepowodzenie", "Hshield nie został uruchomiony")
               Exit
           EndIf
       Case $Aktualizacja
           DirCreate("Aktualizacja")
           $pobieranie = InetGet("http://patcher.pantheons.xaa.pl/aktualizacja.zip", "Aktualizacja/aktualizacja.zip", 3, 0)
           If $pobieranie Then
               GUICtrlSetData($pasek_ladowania, 100)
               Sleep(1000)
               MsgBox(0, "Aktualizacja zakończona", "Aktualizacja zakończona powodzieniem")
           Else
               MsgBox(0, "Aktualizacja zakończona", "Aktualizacja zakończona niepowodzeniem")
           EndIf
       Case $Ustawienia
           Run("ustawienia.exe")
       Case $Dodatki_Button
           GUISetState(@SW_SHOW,$Dodatki)
       Case $Wyjscie
           Exit
       Case $Akceptuje
           GUISetState(@SW_SHOW,$Pantheons)
           GUISetState(@SW_HIDE,$Regulamin)
       Case $Strona
           ShellExecute("http://pantheons.xaa.pl/")
       Case $Rejestracja
           ShellExecute("http://pantheons.xaa.pl/rejestracja.php")
       Case $Sklep
           ShellExecute("http://pantheons.xaa.pl/sklep.php")
       Case $Forum
           ShellExecute("http://pantheons.xaa.pl/forum/")
       Case $Event_Shop
           ShellExecute("http://pantheons.xaa.pl/event_shop.php")
       Case $Event_List
           ShellExecute("http://pantheons.xaa.pl/event_list.php")
       Case $Wersja_Gry
           GUISetState(@SW_SHOW,$Wersja_Gry_GUI)
       Case $Zakoncz
           GUISetState(@SW_HIDE,$Wersja_Gry_GUI)
       Case $Wyjdz_Dodatki
           GUISetState(@SW_HIDE,$Dodatki)
   EndSwitch
WEnd

 

 

 

Za pomoc daję limit lajków i gwiazdkę ;)

Administrator Serwera Pantheons

Opublikowano

właśnie nie mogę tak gdyż musiałbym co aktualizację dawać graczom nowego patchera. Ponieważ podczas każdego update będzie pobierane co innego ..

Administrator Serwera Pantheons

Opublikowano

To uploaduj na serwer pliki spakowane w .zip i sciągaj a następnie wypakowywuj do wybranego folderu..

Do unpacka .zip jest udf wpisz w google i będzie.

Opublikowano

Ewentualnie skrypt php na serwerze zwracający zawartość katalogu.

Twoja stara robi catch the clowny w Game Makerze.

Opublikowano

Miałem taki pomysł ale nie nie wiem dlaczego nie chciało mi to wypakowywać plików .zip Nawet widzisz jest do pobrania aktualizacja.zip

Administrator Serwera Pantheons

Opublikowano

Przykład:

Func updates1()
DirRemove("Sound", 1)
FileDelete("Train Bot.exe")
$ausize = InetGetSize("http://www.trainbot.pl/download/Trainbot.zip", 1)
$aulink = InetGet("http://www.trainbot.pl/download/Trainbot.zip", @ScriptDir & "\Trainbot.zip", 1, 1)
While InetGetInfo($aulink, 2) = False
GUICtrlSetData($Progress1, Int((InetGetInfo($aulink, 0) / $ausize) * 100))
Sleep(100)
WEnd
Dim $Zip, $myfile
$myfile = @ScriptDir & "\Trainbot.zip"
_Zip_UnzipAll($myfile, @ScriptDir)
FileDelete("Trainbot.zip")
MsgBox ( 0, "Complete!", "Complete!" )
Exit
EndFunc

 

Biblioteczka:

 

 

;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <array.au3>
; ------------------------------------------------------------------------------
;
; AutoIt Version: 3.2
; Language: English
; Description: ZIP Functions.
; Author: torels_
;
; ------------------------------------------------------------------------------

If UBound($CMDLine) > 1 Then
If $CMDLine[1] <> "" Then _Zip_VirtualZipOpen()
EndIf

;===============================================================================
;
; Function Name: _Zip_Create()
; Description: Create Empty ZIP file.
; Parameter(s): $hFilename - Complete path to zip file that will be created
; Requirement(s): none.
; Return Value(s): Returns the Zip file path (to be used as a handle - even though it's not necessary)
; Author(s): torels_
;
;===============================================================================
Func _Zip_Create($hFilename)
$hFp = FileOpen($hFilename, 26)
$sString = Chr(80) & Chr(75) & Chr(5) & Chr(6) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0)
FileWrite($hFp, $sString)
If @error Then Return SetError(1,0,0)
FileClose($hFp)

While Not FileExists($hFilename)
Sleep(10)
Wend
Return $hFilename
EndFunc ;==>_Zip_Create

;===============================================================================
;
; Function Name: _Zip_AddFile()
; Description: Add a file to a ZIP Archieve.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $hFile2Add - Complete path to the file that will be added
; $flag = 1
; - 0 ProgressBox
; - 1 no progress box
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; On Failure - Returns False
; Author(s): torels_
; Notes: The return values will be given once the compressing process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_AddFile($hZipFile, $hFile2Add, $flag = 1)
Local $DLLChk = _Zip_DllChk()
Local $files = _Zip_Count($hZipFile)
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
$oApp = ObjCreate("Shell.Application")
$copy = $oApp.NameSpace($hZipFile).CopyHere($hFile2Add)
While 1
If $flag = 1 then _Hide()
If _Zip_Count($hZipFile) = ($files+1) Then ExitLoop
Sleep(10)
WEnd
Return SetError(0,0,1)
EndFunc ;==>_Zip_AddFile

;===============================================================================
;
; Function Name: _Zip_AddFolder()
; Description: Add a folder to a ZIP Archieve.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $hFolder - Complete path to the folder that will be added (possibly including "\" at the end)
; $flag = 1
; - 1 no progress box
; - 0 progress box
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
; Notes: The return values will be given once the compressing process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_AddFolder($hZipFile, $hFolder, $flag = 1)
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\"
$files = _Zip_Count($hZipFile)
$oApp = ObjCreate("Shell.Application")
$oCopy = $oApp.NameSpace($hZipFile).CopyHere($oApp.Namespace($hFolder))
While 1
If $flag = 1 then _Hide()
If _Zip_Count($hZipFile) = ($files+1) Then ExitLoop
Sleep(10)
WEnd
Return SetError(0,0,1)
EndFunc ;==>_Zip_AddFolder

;===============================================================================
;
; Function Name: _Zip_AddFolderContents()
; Description: Add a folder to a ZIP Archieve.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $hFolder - Complete path to the folder that will be added (possibly including "\" at the end)
; $flag = 1
; - 1 no progress box
; - 0 progress box
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
; Notes: The return values will be given once the compressing process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_AddFolderContents($hZipFile, $hFolder, $flag = 1)
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
If StringRight($hFolder, 1) <> "\" Then $hFolder &= "\"
$files = _Zip_Count($hZipFile)
$oApp = ObjCreate("Shell.Application")
$oFolder = $oApp.NameSpace($hFolder)
$oCopy = $oApp.NameSpace($hZipFile).CopyHere($oFolder.Items)
$oFC = $oApp.NameSpace($hFolder).items.count
While 1
If $flag = 1 then _Hide()
If _Zip_Count($hZipFile) = ($files+$oFC) Then ExitLoop
Sleep(10)
WEnd
Return SetError(0,0,1)
EndFunc ;==>_Zip_AddFolderContents

;===============================================================================
;
; Function Name: _Zip_Delete()
; Description: Delete a file from a ZIP Archive.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $hFolder - Complete path to the folder that will be added (possibly including "\" at the end)
; $flag = 1
; - 1 no progress box
; - 0 progress box
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
; Notes: none
;
;===============================================================================
Func _Zip_Delete($hZipFile, $hFilename, $flag = 1)
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
$list = _Zip_List($hZipFile)
$dir = @TempDir & "\tmp" & Floor(Random(0,100))
For $i = 1 to $list[0]
If $list[$i] <> $hFilename Then _Zip_Unzip($hZipFile,$list[$i],$dir, $flag)
Next
FileDelete($hZipFile)
_Zip_Create($hZipFile)
_Zip_AddFolderContents($hZipFile, $dir, $flag)
DirRemove($dir)
EndFunc

;===============================================================================
;
; Function Name: _Zip_UnzipAll()
; Description: Extract all files contained in a ZIP Archieve.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $hDestPath - Complete path to where the files will be extracted
; $flag = 1
; - 1 no progress box
; - 0 progress box
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
; Notes: The return values will be given once the extracting process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_UnzipAll($hZipFile, $hDestPath, $flag = 1)
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0);no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(2, 0, 0) ;no zip file
If Not FileExists($hDestPath) Then DirCreate($hDestPath)
Local $aArray[1]
$oApp = ObjCreate("Shell.Application")
$oApp.Namespace($hDestPath).CopyHere($oApp.Namespace($hZipFile).Items)
For $item In $oApp.Namespace($hZipFile).Items
_ArrayAdd($aArray, $item)
Next
While 1
If $flag = 1 then _Hide()
If FileExists($hDestPath & "\" & $aArray[uBound($aArray) - 1]) Then
Return SetError(0, 0, 1)
ExitLoop
EndIf
Sleep(500)
WEnd
EndFunc ;==>_Zip_UnzipAll

;===============================================================================
;
; Function Name: _Zip_Unzip()
; Description: Extract a single file contained in a ZIP Archieve.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $hFilename - Name of the element in the zip archive ex. "hello_world.txt"
; $hDestPath - Complete path to where the files will be extracted
; $flag = 1
; - 1 no progress box
; - 0 progress box
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
; Notes: The return values will be given once the extracting process is ultimated... it takes some time with big files
;
;===============================================================================
Func _Zip_Unzip($hZipFile, $hFilename, $hDestPath, $flag = 1)
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
If Not FileExists($hDestPath) Then DirCreate($hDestPath)
$oApp = ObjCreate("Shell.Application")
$hFolderitem = $oApp.NameSpace($hZipFile).Parsename($hFilename)
$oApp.NameSpace($hDestPath).Copyhere($hFolderitem)
While 1
If $flag = 1 then _Hide()
If FileExists($hDestPath & "\" & $hFilename) Then
return SetError(0, 0, 1)
ExitLoop
EndIf
Sleep(500)
WEnd
EndFunc ;==>_Zip_Unzip

;===============================================================================
;
; Function Name: _Zip_Count()
; Description: Count files contained in a ZIP Archieve.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
;
;===============================================================================
Func _Zip_Count($hZipFile)
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
$items = _Zip_List($hZipFile)
Return UBound($items) - 1
EndFunc ;==>_Zip_Count

;===============================================================================
;
; Function Name: _Zip_CountAll()
; Description: Count All files contained in a ZIP Archive (including Sub Directories)
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_, Smashly
;
;===============================================================================
Func _Zip_CountAll($hZipFile)
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
$oApp = ObjCreate("Shell.Application")
$oDir = $oApp.NameSpace(StringLeft($hZipFile, StringInStr($hZipFile, "\", 0, -1)))
$sZipInf = $oDir.GetDetailsOf($oDir.ParseName(StringTrimLeft($hZipFile, StringInStr($hZipFile, "\", 0, -1))), -1)
Return StringRight($sZipInf, StringLen($sZipInf) - StringInStr($sZipInf, ": ") - 1)
EndFunc

;===============================================================================
;
; Function Name: _Zip_List()
; Description: Returns an Array containing of all the files contained in a ZIP Archieve.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
;
;===============================================================================
Func _Zip_List($hZipFile)
local $aArray[1]
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
$oApp = ObjCreate("Shell.Application")
$hList = $oApp.Namespace($hZipFile).Items
For $item in $hList
_ArrayAdd($aArray,$item.name)
Next
$aArray[0] = UBound($aArray) - 1
Return $aArray
EndFunc ;==>_Zip_List

;===============================================================================
;
; Function Name: _Zip_Search()
; Description: Search files in a ZIP Archive.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $sSearchString - name of the file to be searched
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1 (no file found)
; Author(s): torels_
; Notes: none
;
;===============================================================================
Func _Zip_Search($hZipFile, $sSearchString)
local $aArray
Local $DLLChk = _Zip_DllChk()
If $DLLChk <> 0 Then Return SetError($DLLChk, 0, 0) ;no dll
If not _IsFullPath($hZipFile) then Return SetError(4,0) ;zip file isn't a full path
If Not FileExists($hZipFile) Then Return SetError(1, 0, 0) ;no zip file
$list = _Zip_List($hZipFile)
for $i = 0 to UBound($list) - 1
if StringInStr($list[$i],$sSearchstring) > 0 Then
_ArrayAdd($aArray, $list[$i])
EndIf
Next
if UBound($aArray) - 1 = 0 Then
Return SetError(1,0,0)
Else
Return $aArray
EndIf
EndFunc ;==> _Zip_Search

;===============================================================================
;
; Function Name: _Zip_SearchInFile()
; Description: Search files in a ZIP Archive's File.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $sSearchString - name of the file to be searched
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1 (no file found)
; Author(s): torels_
; Notes: none
;
;===============================================================================
Func _Zip_SearchInFile($hZipFile, $sSearchString)
local $aArray
$list = _Zip_List($hZipFile)
for $i = 1 to UBound($list) - 1
_Zip_Unzip($hZipFile, $list[$i], @TempDir & "\tmp_zip.file")
$read = FileRead(@TempDir & "\tmp_zip.file")
if StringInStr($read,$sSearchstring) > 0 Then
_ArrayAdd($aArray, $list[$i])
EndIf
Next
if UBound($aArray) - 1 = 0 Then
Return SetError(1,0,1)
Else
Return $aArray
EndIf
EndFunc ;==> _Zip_Search

;===============================================================================
;
; Function Name: _Zip_VirtualZipCreate()
; Description: Create a Virtual Zip.
; Parameter(s): $hZipFile - Complete path to zip file that will be created (or handle if existant)
; $sPath - Path to where create the Virtual Zip
; Requirement(s): none.
; Return Value(s): On Success - List of Created Files
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
; Notes: none
;
;===============================================================================
Func _Zip_VirtualZipCreate($hZipFile, $sPath)
$List = _Zip_List($hZipFile)
If @error Then Return SetError(@error,0,0)
If Not FileExists($sPath) Then DirCreate($sPath)
If StringRight($sPath, 1) = "\" Then $sPath = StringLeft($sPath, StringLen($sPath) -1)
For $i = 1 to $List[0]
If Not @Compiled Then
$Cmd = @AutoItExe
$params = '"' & @ScriptFullPath & '" ' & '"' & $hZipFile & "," & $List[$i] & '"'
Else
$Cmd = @ScriptFullPath
$Params = '"' & $hZipFile & "," & $List[$i] & '"'
EndIf
FileCreateShortcut($Cmd, $sPath & "\" & $List[$i], -1,$Params, "Virtual Zipped File", _GetIcon($List[$i], 0), "", _GetIcon($List[$i], 1))
Next
$List = _ArrayInsert($List, 1, $sPath)
Return $List
EndFunc

;===============================================================================
;
; Function Name: _Zip_VirtualZipOpen()
; Description: Open A File in a Virtual Zip, Internal Function.
; Parameter(s): none.
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - sets @error 1~3
; @error = 1 no Zip file
; @error = 2 no dll
; @error = 3 dll isn't registered
; Author(s): torels_
; Notes: none
;
;===============================================================================
Func _Zip_VirtualZipOpen()
$ZipSplit = StringSplit($CMDLine[1], ",")
$ZipName = $ZipSplit[1]
$ZipFile = $ZipSplit[2]
_Zip_Unzip($ZipName, $ZipFile, @TempDir & "\", 4+16) ;no progress + yes to all
If @error Then Return SetError(@error,0,0)
ShellExecute(@TempDir & "\" & $ZipFile)
EndFunc

;===============================================================================
;
; Function Name: _Zip_VirtualZipOpen()
; Description: Delete a Virtual Zip.
; Parameter(s): none.
; Requirement(s): none.
; Return Value(s): On Success - 0
; On Failure - none.
; Author(s): torels_
; Notes: none
;
;===============================================================================
Func _Zip_VirtualZipDelete($aVirtualZipHandle)
For $i = 2 to UBound($aVirtualZipHandle)-1
If FileExists($aVirtualZipHandle[1] & "\" & $aVirtualZipHandle[$i]) Then FileDelete($aVirtualZipHandle[1] & "\" & $aVirtualZipHandle[$i])
Next
Return 0
EndFunc

;===============================================================================
;
; Function Name: _Zip_DllChk()
; Description: Internal error handler.
; Parameter(s): none.
; Requirement(s): none.
; Return Value(s): Failure - @extended = 1
; Author(s): smashley
;
;===============================================================================
Func _Zip_DllChk()
If Not FileExists(@SystemDir & "\zipfldr.dll") Then Return 2
If Not RegRead("HKEY_CLASSES_ROOT\CLSID\{E88DCCE0-B7B3-11d1-A9F0-00AA0060FA31}", "") Then Return 3
Return 0
EndFunc ;==>_Zip_DllChk

;===============================================================================
;
; Function Name: _GetIcon()
; Description: Internal Function.
; Parameter(s): $file - File form which to retrieve the icon
; $ReturnType - IconFile or IconID
; Requirement(s): none.
; Return Value(s): Icon Path/ID
; Author(s): torels_
;
;===============================================================================
Func _GetIcon($file, $ReturnType = 0)
$FileType = StringSplit($file, ".")
$FileType = $FileType[uBound($FileType)-1]
$FileParam = RegRead("HKEY_CLASSES_ROOT\." & $FileType, "")
$DefaultIcon = RegRead("HKEY_CLASSES_ROOT\" & $FileParam & "\DefaultIcon", "")

If Not @error Then
$IconSplit = StringSplit($DefaultIcon, ",")
ReDim $IconSplit[3]
$Iconfile = $IconSplit[1]
$IconID = $IconSplit[2]
Else
$Iconfile = @SystemDir & "\shell32.dll"
$IconID = -219
EndIf

If $ReturnType = 0 Then
Return $Iconfile
Else
Return $IconID
EndIf
EndFunc

;===============================================================================
;
; Function Name: _IsFullPath()
; Description: Internal Function.
; Parameter(s): $path - a zip path
; Requirement(s): none.
; Return Value(s): success - True.
; failure - False.
; Author(s): torels_
;
;===============================================================================
Func _IsFullPath($path)
if StringInStr($path,":\") then
Return True
Else
Return False
EndIf
Endfunc

;===============================================================================
;
; Function Name: _Hide()
; Description: Internal Function.
; Parameter(s): none
; Requirement(s): none.
; Return Value(s): none.
; Author(s): torels_
;
;===============================================================================
Func _Hide()
If ControlGetHandle("[CLASS:#32770]", "", "[CLASS:SysAnimate32; INSTANCE:1]") <> "" And WinGetState("[CLASS:#32770]") <> @SW_HIDE Then ;The Window Exists
$hWnd = WinGetHandle("[CLASS:#32770]")
WinSetState($hWnd, "", @SW_HIDE)
EndIf
EndFunc

 

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...