Code: Select all
#NoEnv
SetWorkingDir, %A_ScriptDir%
#SingleInstance force
;#Persistent
FileEncoding, UTF-8
SetBatchLines, -1
SetTitleMatchMode, 2
SetKeyDelay 20
;##########################################################################################################
; https://www.autohotkey.com/boards/viewtopic.php?f=9&t=115685
global iteration := 0 ; test
Gui, New, +hwndhGUIA +E0x20 ; +AlwaysOnTop +Owner +LastFound +Border +Caption +Resize -ToolWindow, control
Gui, Font, s10
Gui, Add, Tab3,,Home|Statistik
Gui, Tab, 1
Gui, Add, ListView,% "w" A_ScreenWidth-430 " r20 vLV gLV +LV0x00010000 Section", Count|Iterum|MD5|Medium|Speicherort
Gui, Add, Button, Section w160 gEditScript,% Chr(0xE115) " Edit Script"
Gui, Add, Button, ys w160 gPauseScript vPauseScript, Pause
Gui, Add, Button, ys w160 gClearListView, ClearListView
;Gui, Tab, 2
Gui, Show,% " w" A_ScreenWidth-380 " h" A_ScreenHeight-450,% a_scriptName
GuiControl , Choose , systabcontrol321 , 1
audio := "|aac|ac3|aif|aifc|aiff|au|cda|dts|fla|flac|it|m1a|m2a|m3u|m4a|mid|midi|mka|mod|mp2|mp3|mpa|ogg|ra|rmi|spc|rmi|snd|umx|voc|wav|wma|xm|"
bilder := "|ani|bmp|gif|ico|jpe|jpeg|jpg|pcx|png|psd|tga|tif|tiff|wmf|"
videos := "|3g2|3gp|3gp2|3gpp|amr|amv|asf|avi|bdmv|bik|d2v|divx|drc|dsa|dsm|dss|dsv|evo|f4v|flc|fli|flic|flv|hdmov|ifo|ivf|m1v|m2p|m2t|m2ts|m2v|m4b|m4p|m4v|mkv|mp2v|mp4|mp4v|mpe|mpeg|mpg|mpls|mpv2|mpv4|mov|mts|ogm|ogv|pss|pva|qt|ram|ratdvd|rm|rmm|rmvb|roq|rpm|smil|smk|swf|tp|tpr|ts|vob|vp6|webm|wm|wmp|wmv|"
Ausführbare_Dateien := "|bat|cmd|exe|msi|msp|scr|com|"
Dokumente := "|c|chm|cpp|csv|cxx|doc|docm|docx|dot|dotm|dotx|h|hpp|htm|html|hxx|ini|java|lua|mht|mhtml|odt|pdf|potx|potm|ppam|ppsm|ppsx|pps|ppt|pptm|pptx|rtf|sldm|sldx|thmx|txt|vsd|wpd|wps|wri|xlam|xls|xlsb|xlsm|xlsx|xltm|xltx|xml|"
Archive := "|7z|ace|arj|bz2|cab|gz|gzip|jar|r00|r01|r02|r03|r04|r05|r06|r07|r08|r09|r10|r11|r12|r13|r14|r15|r16|r17|r18|r19|r20|r21|r22|r23|r24|r25|r26|r27|r28|r29|rar|tar|tgz|z|zip|"
allMedia := audio videos
TrueFileExt := allMedia
thisFileList := ""
QuellPfad := ""
thisANow := A_Now
FileSelectFolder, QuellPfad, , , Verzeichnis auswählen
if QuellPfad
{
Loop, Files, %QuellPfad%\*.*, FR
If TrueFileExt contains |%A_LoopFileExt%|
thisFileList .= A_LoopFilePath "`n"
}else{
ExitApp
}
thisCounter := 0
For K, thisMediaFile In StrSplit(thisFileList, "`n", "`r")
{
if !thisMediaFile
continue
if fileExist(thisMediaFile ".txt")
continue
setTimer, thisToolTip, 500
thisMD5 := ; MD5 erzeugen
thisMD5 := File_MD5(thisMediaFile, iteration) ; MD5 erzeugen
thisFile := thisMD5 a_tab thisMediaFile "`n"
FileAppend,% thisFile ,% A_ScriptDir "\" thisANow A_Space " SessionFileList.txt"
MI := New MediaInfo()
MI.Open(thisMediaFile)
Info := {}
For K, V In StrSplit("BitRate|Height|FrameRate|Width", "|")
Info[V] := MI.Get("Video", V)
res := ""
For K, V In Info
res .= K . " : " . V . "`n"
FileAppend, % "Hash`nFile MD5 `t`t`t`t : " thisMD5 "`n`n" MI.Inform() "`n" res "`n",% thisMediaFile ".txt"
if !errorlevel
thisCounter++
GuiControl, -ReDraw, LV
tooltipText := thisMediaFile
split := strSplit(thisMediaFile, "\")
verzeichnis := strReplace( thisMediaFile, split[split.length()])
LV_Modify(LV_Add("", thisCounter, iteration, thisMD5, split[split.length()], verzeichnis, ""), "Vis")
Loop, % LV_GetCount("Columns")
LV_ModifyCol(A_Index, "AutoHdr")
GuiControl, +Redraw, LV
iteration := 0
setTimer, thisToolTip, off
SplashTextOff
}
msgBox,% thisCounter " Files`nDone"
Return
thisToolTip:
SplashTextOn,% (A_ScreenWidth-500),,% "MD5: " thisMediaFile " : " iteration
return
LV:
Gui, Submit, nohide
thisCounter := 0
LV_Delete()
return
EditScript:
try run, notepad.exe %A_ScriptName%
return
ClearListView:
Gui, Default
LV_Delete()
return
Pause::Pause ; , Toggle ; Die PAUSE/UNTBR-Taste.
PauseScript:
Pause
return
;##########################################################################################################
; ==================================================================================================
; Lade Dir die passende MediaInfo.dll (32/64-Bit) als Zip- oder 7Z-Archiv von
; https://mediaarea.net/de/MediaInfo/Download/Windows
; und lege sie ins Skriptverzeichnis.
; Der entpackte Download enthält im Unterverzeichnis Developers\List_Of_Parameters
; CSV-Dateien mit den möglichen Parameternamen.
; Die Datei Documentation.html im Unterverzeichnis Developers enthält eine minimale
; Dokumentation.
; ==================================================================================================
Class MediaInfo {
Static Stream := {General: 0
, Video: 1
, Audio: 2
, Text: 3
, Chapters: 4
, Image: 5
, Menu: 6}
Handle := 0
Module := 0
Opened := 0
; -----------------------------------------------------------------------------------------------
__New() {
If !(Module := DllCall("LoadLibrary", "Str", "MediaInfo.dll", "UPtr"))
Throw Exception("Die MediaInfo.dll konnte nicht geladen werden!", -1)
If !(Handle := DllCall("MediaInfo.dll\MediaInfo_New", "UPtr")) {
DllCall("FreeLibrary", "Ptr", Module)
Throw Exception("Die MediaInfo.dll konnte nicht initialisiert werden!", -1)
}
This.Module := Module
This.Handle := Handle
}
; -----------------------------------------------------------------------------------------------
__Delete() {
If (This.Opened)
This.Close()
If (This.Handle)
This.Delete()
If (This.Module)
DllCall("FreeLibrary", "Ptr", Module)
}
; -----------------------------------------------------------------------------------------------
Open(MediaFile) {
If !(This.Handle)
Return False
Return (This.Opened := DllCall("MediaInfo.dll\MediaInfo_Open", "Ptr", This.Handle
, "Str", MediaFile
, "UPtr"))
}
; -----------------------------------------------------------------------------------------------
Get(Stream, Param) {
If !(This.Handle) || !(This.Opened)
Return ""
If !This.Stream.HasKey(Stream)
Return ""
Return DllCall("MediaInfo.dll\MediaInfo_Get", "Ptr", This.Handle
, "UInt", This.Stream[Stream]
, "UInt", 0
, "Str", Param
, "UInt", 1
, "UInt", 0
, "Str")
}
; -----------------------------------------------------------------------------------------------
Inform() {
If !(This.Handle) || !(This.Opened)
Return False
Return DllCall("MediaInfo.dll\MediaInfo_Inform", "Ptr", This.Handle
, "UInt", 0
, "Str")
}
; -----------------------------------------------------------------------------------------------
Close() {
If (This.Opened)
DllCall("MediaInfo.dll\MediaInfo_Close")
This.Opened := 0
Return True
}
; -----------------------------------------------------------------------------------------------
Delete() {
If (This.Opened)
This.Close()
If (This.Handle)
DllCall("MediaInfo.dll\MediaInfo_Delete", "Ptr", This.Handle)
This.Handle := 0
Return True
}
}
;##########################################################################################################
; basiert auf https://autohotkey.com/board/topic/77408-md5-function-for-comparing-images/
; https://www.autohotkey.com/boards/viewtopic.php?p=262628#p262628 ; danke just me
File_MD5(FilePath,ByRef iteration) {
Static MaxSize := 64 * 1024 * 1024 ; 64 MB
MD5 := ""
If !(File := FileOpen(FilePath, "r"))
Return "" ; hier vielleicht noch eine aussagekräftigere Fehlerbehandlung einfügen
File.Pos := 0
FileSize := File.Length
VarSetCapacity(MD5_CTX, 104, 0)
DllCall("Advapi32.dll\MD5Init", "Ptr", &MD5_CTX)
While (FileSize > MaxSize) {
File.RawRead(Buffer, MaxSize)
DllCall("Advapi32.dll\MD5Update", "Ptr", &MD5_CTX, "Ptr", &Buffer, "UInt", MaxSize)
FileSize -= MaxSize
iteration++
}
File.RawRead(Buffer, FileSize)
DllCall("Advapi32.dll\MD5Update", "Ptr", &MD5_CTX, "Ptr", &Buffer, "UInt", FileSize)
DllCall("Advapi32.dll\MD5Final", "Ptr", &MD5_CTX)
File.CLose()
Loop, 16
MD5 .= Format("{:02X}", NumGet(MD5_CTX, 87 + A_Index, "UChar"))
Return MD5
}