⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 7zip.au3

📁 7zip script for auto-compression
💻 AU3
📖 第 1 页 / 共 3 页
字号:
EndFunc   ;==>_7ZipGetDate

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipGetTime
; Description ...: Returns a time of files in an archive
; Syntax.........: _7ZipGetTime($hArc)
; Parameters ....: $hArc - Archive handle
; Return values .: Success - Returns a time in an MSDOS format
;                  Failure - Returns -1
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipGetTime($hArc)
	Local $aRet = DllCall($hDLL_7ZIP, "short", "SevenZipGetTime", _
												"hwnd", $hArc)
	If $aRet[0] = -1 Then Return $aRet[0]
	Return "0x" & Hex($aRet[0], 4)
EndFunc   ;==>_7ZipGetTime

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipGetCRC
; Description ...: Returns a CRC of files in an archive
; Syntax.........: _7ZipGetCRC($hArc)
; Parameters ....: $hArc - Archive handle
; Return values .: Success - Returns a CRC
;                  Failure - Returns -1
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipGetCRC($hArc)
	Local $aRet = DllCall($hDLL_7ZIP, "dword", "SevenZipGetCRC", _
												"hwnd", $hArc)
	Return $aRet[0]
EndFunc   ;==>_7ZipGetCRC

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipGetAttribute
; Description ...: Returns a attribute of files in an archive
; Syntax.........: _7ZipGetAttribute($hArc)
; Parameters ....: $hArc - Archive handle
; Return values .: Success - Returns attribute of the file
;                  Failure - Returns -1
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipGetAttribute($hArc)
	Local $aRet = DllCall($hDLL_7ZIP, "int", "SevenZipGetAttribute", _
											 "hwnd", $hArc)
	If $aRet[0] = -1 Then Return $aRet[0]
	Return "0x" & Hex($aRet[0], 2)
EndFunc   ;==>_7ZipGetAttribute

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipGetMethod
; Description ...: Returns a string with the method of compressing
; Syntax.........: _7ZipGetMethod($hArc)
; Parameters ....: $hArc - Archive handle
; Return values .: Success - Returns the method of compressing
;                  Failure - Returns -1
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipGetMethod($hArc)
	Local $sBUFFER = DllStructCreate("char[8]")

	Local $aRet = DllCall($hDLL_7ZIP, "int", "SevenZipGetMethod", _
											 "hwnd", $hArc, _
											 "ptr", DllStructGetPtr($sBUFFER), _
											 "int", DllStructGetSize($sBUFFER))
	If $aRet[0] <> 0 Then Return False
	Return DllStructGetData($sBUFFER, 1)
EndFunc   ;==>_7ZipGetMethod

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZIPCheckArchive
; Description ...: Checks archive files
; Syntax.........: _7ZIPCheckArchive($sArcName)
; Parameters ....: $sArcName - Archive file name
; Return values .: Success   - 1
;                  Failure   - 0
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipCheckArchive($sArcName)
	Local $aRet = DllCall($hDLL_7ZIP, "int", "SevenZipCheckArchive", _
											 "str", $sArcName, _
											 "int", 0)
	Return $aRet[0]
EndFunc   ;==>_7ZIPCheckArchive

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipGetArchiveType
; Description ...: Returns the archive type
; Syntax.........: _7ZipGetArchiveType($sArcName)
; Parameters ....: $sArcName - Archive file name
; Return values .: Success: 1 - ZIPtype
;							2 - 7Ztype
;							0 - Unknown type
;                  Failure    - -1
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipGetArchiveType($sArcName)
	Local $aRet = DllCall($hDLL_7ZIP, "int", "SevenZipGetArchiveType", _
											 "str", $sArcName)
	Return $aRet[0]
EndFunc   ;==>_7ZIPGetArchiveType

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipGetFileCount
; Description ...: Returns the archive files count
; Syntax.........: _7ZipGetFileCount($sArcName)
; Parameters ....: $sArcName - Archive file name
; Return values .: Success   - Returns the number of files
;                  Failure   - Returns -1
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipGetFileCount($sArcName)
	Local $aRet = DllCall($hDLL_7ZIP, "int", "SevenZipGetFileCount", _
											 "str", $sArcName)
	Return $aRet[0]
EndFunc

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipConfigDialog
; Description ...: Shows a about dialog of the 7-zip32.dll
; Syntax.........: SevenZipConfigDialog($hWnd)
; Parameters ....: $hWnd   - Handle to parent or owner window
; Return values .: Success - Returns 1
;                  Failure - Returns 0
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipConfigDialog($hWnd)
	Local $aRet = DllCall($hDLL_7ZIP, "int", "SevenZipConfigDialog", _
											 "hwnd", $hWnd, _
											 "ptr", 0, _
											 "int", 0)
	Return $aRet[0]
EndFunc   ;==>SevenZipConfigDialog

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipQueryFunctionList
; Description ...: Checks whether or not API function which is appointed with 7-zip32.dll
; Syntax.........: _7ZipQueryFunctionList($iFunction)
; Parameters ....: $iFunction - The unique numerical value of the function
; Return values .: Success - Returns 1
;                  Failure - Returns 0
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipQueryFunctionList($iFunction = 0)
	Local $aRet = DllCall($hDLL_7ZIP, "int", "SevenZipQueryFunctionList", _
											 "int", $iFunction)
	Return $aRet[0]
EndFunc   ;==>_7ZipQueryFunctionList

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipGetVersion
; Description ...: Returns a version of the 7-zip32.dll
; Syntax.........: _7ZipGetVersion()
; Parameters ....: None
; Return values .: The version number
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipGetVersion()
	Local $aRet = DllCall($hDLL_7ZIP, "short", "SevenZipGetVersion")
	Return StringLeft($aRet[0], 1) & "." & StringTrimLeft($aRet[0], 1)
EndFunc   ;==>_7ZipGetVersion

; #FUNCTION# ====================================================================================================================
; Name...........: _7ZipGetSubVersion
; Description ...: Returns a sub-version of the 7-zip32.dll
; Syntax.........: _7ZipGetSubVersion()
; Parameters ....: None
; Return values .: The sub-version number
; Author ........: R. Gilman (rasim)
; ===============================================================================================================================
Func _7ZipGetSubVersion()
	Local $aRet = DllCall($hDLL_7ZIP, "short", "SevenZipGetSubVersion")
	Return $aRet[0]
EndFunc   ;==>_7ZipGetSubVersion

; #FUNCTIONS FOR INTERNAL USE# ==================================================================================================
Func _RecursionSet($sVal)
	Switch $sVal
		Case 1
			Return " -r"
		Case 2
			Return " -r0"
		Case Else
			Return " -r-"
	EndSwitch
EndFunc   ;==>_RecursionSet

Func _IncludeFileSet($sVal)
	If StringInStr($sVal, "*") Then
		Return ' -i!"' & $sVal & '"'
	ElseIf StringLeft($sVal, 1) = "@" Then
		Return ' -i"' & $sVal  & '"'
	Else
		Return ' -i!"' & $sVal & '"'
	EndIf
EndFunc   ;==>_IncludeFileSet

Func _ExcludeFileSet($sVal)
	If StringInStr($sVal, "*") Then
		Return ' -x!"' & $sVal & '"'
	ElseIf StringLeft($sVal, 1) = "@" Then
		Return ' -x"' & $sVal & '"'
	Else
		Return ' -x!"' & $sVal & '"'
	EndIf
EndFunc   ;==>_ExcludeFileSet

Func _OverwriteSet($sVal)
	Switch $sVal
		Case 0
			Return " -aoa"
		Case 1
			Return " -aos"
		Case 2
			Return " -aou"
		Case 3
			Return " -aot"
		Case Else
			Return " -aoa"
	EndSwitch
EndFunc   ;==>_OverwriteSet

Func _IncludeArcSet($sVal)
	If StringInStr($sVal, "*") Then
		Return ' -ai!"' & $sVal & '"'
	ElseIf StringLeft($sVal, 1) = "@" Then
		Return ' -ai"' & $sVal & '"'
	Else
		Return ' -ai!"' & $sVal & '"'
	EndIf
EndFunc   ;==>_IncludeArcSet

Func _ExcludeArcSet($sVal)
	If StringInStr($sVal, "*") Then
		Return ' -ax!"' & $sVal & '"'
	ElseIf StringLeft($sVal, 1) = "@" Then
		Return ' -ax"' & $sVal & '"'
	Else
		Return ' -ax!"' & $sVal & '"'
	EndIf
EndFunc   ;==>_ExcludeArcSet

Func OnAutoitExit()
	If IsDeclared("hDLL_7ZIP") Then
		DllClose($hDLL_7ZIP)
		If $hArchiveProc Then DllCallbackFree($hArchiveProc)
	EndIf
EndFunc   ;==>OnAutoitExit

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -