#include #include ; for $ES_NUMBER #include #include #include #include #include "GUIExtender.au3" ; for the collapsing Bad Frames settings Local $helpmenu, $infoitem, $exititem, $msg, $mainWin_Pos, $TestFileList Global $mainWin, $aboutWin, $infoWin, $Root_Folder, $Master_Folder, $MovieFormat, $FirstFile = "", $MasterFileList, $XS_n, $NumFilesTested, $NumFilesMaster Global $cutNameFrom, $cutNameTo, $currentProgressAll2, $currentProgressAll, $FirstFileFolderNoExt, $cutFileFolder, $OutImage_Folder = "" Global $LevelFolderList = [] $TestSingleFolderSelection = true #region GUI $mainWin = GUICreate("Test Movie Integrity v1.21", 340, 875) $mainWin_Pos = WinGetPos($mainWin, "") Local $filemenu = GUICtrlCreateMenu("&File") GUICtrlSetState(-1, $GUI_DEFBUTTON) GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $helpmenu = GUICtrlCreateMenu("Help") $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu) $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu) _GUIExtender_Init($mainWin, 0, 0, True) ; adding the ",0 ,0, True" (true really) - enables the spinners to show in the hidden section ; Start defining sections - this is everything up to the first active section $checkBoxes_Section = _GUIExtender_Section_Create($mainWin, 0, 130) ; Just to show section height - red = fixed, green = active GUICtrlCreateLabel("", 0, 0, 10, 130) GUICtrlSetBkColor(-1, 0xFF0000) GUIStartGroup() $String_Title = "PERFORM THE FOLLOWING TESTS:" $Label_Title = GUICtrlCreateLabel($String_Title, 85, 10, 200, 15) $Test_Audio = GUICtrlCreateCheckbox("Missing Audio", 50, 40, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $Test_Black = GUICtrlCreateCheckbox("Bad Frames", 50, 65, 100, 20) GUICtrlSetState(-1, $GUI_CHECKED) $Test_Missing = GUICtrlCreateCheckbox("Missing Files", 50, 90, 100, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) $Test_Length = GUICtrlCreateCheckbox("Incorrect Movie Length", 170, 40, 150, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) $Test_Resolution = GUICtrlCreateCheckbox("Incorrect Movie Resolution", 170, 65, 150, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) $Test_Size = GUICtrlCreateCheckbox("Improbable File Size", 170, 90, 150, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) GUICtrlCreateLabel("Bad Frames Settings...", 70, 115, 150, 15) _GUIExtender_Section_Activate($mainWin, $checkBoxes_Section + 1, "", "", 48, 115, 15, 15) ; Note easy way to denote next section ; Only need start a new section here - everything above is in the same fixed section $BadFramesSettings_Section = _GUIExtender_Section_Create($mainWin, -1, 30) ; Save the section ID as a variable to use later ; Just to show section height GUICtrlCreateLabel("", 0, 130, 10, 30) GUICtrlSetBkColor(-1, 0x00FF00) $Label_Threshold = GUICtrlCreateLabel("Threshold of:", 10, 134, 100, 15) $Label_BadFrames = GUICtrlCreateLabel("BadFrames:", 60, 143, 80, 15) Global $iInitialValue = 0.6 Global $iIncrement = .1 $BadFramesThreshold = GUICtrlCreateInput($iInitialValue, 115, 140, 30, 20, $ES_NUMBER) $cDummyInput = GUICtrlCreateInput("", 160, 140, 1, 20) $BadFramesThresholdSpinner = GUICtrlCreateUpdown($cDummyInput, $UDS_ARROWKEYS) GUICtrlSetFont ($Label_Threshold, 7, 500, 0, "Tahoma") GUICtrlSetFont ($Label_BadFrames, 7, 500, 0, "Tahoma") GUICtrlSetFont ($BadFramesThreshold, 7, 500, 0, "Tahoma") $Label_Artefacts = GUICtrlCreateLabel("Artefacts:", 165, 143, 60, 15) $ArtefactsThreshold = GUICtrlCreateInput("205", 210, 140, 45, 20, $ES_NUMBER) $ArtefactsThresholdSpinner = GUICtrlCreateUpdown($ArtefactsThreshold, 0x0080) ; 0x0080 prevents the thousand separator that would read the number incorrectly GUICtrlSetLimit(-1, 1000, 0) GUICtrlSetFont ($Label_Artefacts, 7, 500, 0, "Tahoma") GUICtrlSetFont ($ArtefactsThreshold, 7, 500, 0, "Tahoma") $Label_Flicker = GUICtrlCreateLabel("Flicker:", 258, 143, 40, 15) $FlickerThreshold = GUICtrlCreateInput("30", 290, 140, 40, 20, $ES_NUMBER) $FlickerThresholdSpinner = GUICtrlCreateUpdown($FlickerThreshold, 0x0080) ; 0x0080 prevents the thousand separator that would read the number incorrectly GUICtrlSetLimit(-1, 100, 0) GUICtrlSetFont ($Label_Flicker, 7, 500, 0, "Tahoma") GUICtrlSetFont ($FlickerThreshold, 7, 500, 0, "Tahoma") ; Now we start the next fixed section $Movie_Section = _GUIExtender_Section_Create($mainWin, -1, 420) GUICtrlCreateLabel("", 0, 160, 10, 420) GUICtrlSetBkColor(-1, 0x0000FF) $String_MovieFormat = "Movie Format:" $Label_MovieFormat = GUICtrlCreateLabel($String_MovieFormat, 50, 183, 80, 15) $MovieFormat_Combo = GUICtrlCreateCombo("MP4", 120, 180, 50, 20) GUICtrlSetData($MovieFormat_Combo, "MOV|AVI", "MP4") ;GUICtrlSetTip($MovieFormat_Combo, "Make sure the right movie format is set here", "Movie Format", 1, 1) $String_SizeThreshold = "Size Threshold:" $Label_SizeThreshold = GUICtrlCreateLabel($String_SizeThreshold, 212, 163, 80, 15) GUICtrlSetState(-1, $GUI_DISABLE) $SizeThreshold = GUICtrlCreateInput("5000", 50, 10, 50, 30, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $SizeThresholdSpinner = GUICtrlCreateUpdown($SizeThreshold, 0x0080) ; 0x0080 prevents the thousand separator that would read the number incorrectly GUICtrlSetLimit(-1, 10000, 0) GUICtrlSetPos($SizeThreshold, 212, 182, 50, 20) GUICtrlSetState(-1, $GUI_DISABLE) $SizeFormat_Combo = GUICtrlCreateCombo("", 265, 182, 50, 20) GUICtrlSetData($SizeFormat_Combo, "Bytes|Kb|Mb|Gb", "Kb") GUICtrlSetState(-1, $GUI_DISABLE) ; No need for this section - the controls are still in the fixed section we created earlier ;$Folder_Section = _GUIExtender_Section_Create($mainWin, 208, 400) $TestMethodSingle = GUICtrlCreateRadio("Test Single Folder", 70, 210, 110, 15) $TestMethodRoot = GUICtrlCreateRadio("Use Root Folder", 190, 210, 110, 15) GUICtrlSetState($TestMethodSingle, $GUI_CHECKED) $Hide_Reports = GUICtrlCreateCheckbox("Hide Report Notifications", 70, 226, 210, 20) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetFont ($Hide_Reports, 7, 500, 0, "Tahoma") $String_DirLevel = "Directory Levels:" $Label_DirLevel = GUICtrlCreateLabel($String_DirLevel, 210, 230, 80, 15) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetFont ($Label_DirLevel, 7, 500, 0, "Tahoma") $DirLevel = GUICtrlCreateInput("2", 10, 10, 10, 30, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $DirLevelSpinner = GUICtrlCreateUpdown($DirLevel) GUICtrlSetLimit(-1, 9, 1) GUICtrlSetPos($DirLevel, 285, 227, 35, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateGroup("Test Movie Folder", 20, 250, 300, 90) ; Movie Folder Button $Control_MovieFolderButton = GUICtrlCreateButton("Select Test Movie Folder", 60, 270, 220, 25) $String_MovieFolder = "not set" $Label_MovieFolder = GUICtrlCreateLabel($String_MovieFolder, 30, 300, 280, 15, $SS_CENTER) $String_FoundFiles = "" $Label_FoundFiles = GUICtrlCreateLabel($String_FoundFiles, 30, 320, 280, 15, $SS_CENTER) GUICtrlCreateGroup("Master Movie Folder", 20, 355, 300, 190) ; Master Movie Folder Button $Control_MasterMovieFolderButton = GUICtrlCreateButton("Select Master Movie Folder", 60, 375, 220, 25) GUICtrlSetState(-1, $GUI_DISABLE) $String_MasterMovieFolder = "not set" $Label_MasterMovieFolder = GUICtrlCreateLabel($String_MasterMovieFolder, 30, 405, 280, 15, $SS_CENTER) GUICtrlSetState(-1, $GUI_DISABLE) $String_MasterFoundFiles = "" $Label_MasterFoundFiles = GUICtrlCreateLabel($String_MasterFoundFiles, 45, 425, 250, 15, $SS_CENTER) GUICtrlSetState(-1, $GUI_DISABLE) $Label_Identity1 = GUICtrlCreateLabel("Identical names starts at:", 30, 445) GUICtrlSetState(-1, $GUI_DISABLE) $cutNameLeft = GUICtrlCreateInput("5", 10, 10, 50, 20, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $cutNameLeftSpinner = GUICtrlCreateUpdown($cutNameLeft) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetPos($cutNameLeft, 150, 443, 40, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetTip($cutNameLeft, "Number of characters to cut from the START of the name for comparison", "Identical Base", 1, 1) Local $cutNameFrom = Number(GUICtrlRead($cutNameLeft)) $Label_Identity2 = GUICtrlCreateLabel("Cut from end:", 200, 445) GUICtrlSetState(-1, $GUI_DISABLE) $cutNameRight = GUICtrlCreateInput("0", 10, 10, 50, 20, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $cutNameRightSpinner = GUICtrlCreateUpdown($cutNameRight) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetPos($cutNameRight, 270, 443, 40, 20) GUICtrlSetState(-1, $GUI_DISABLE) Local $cutNameTo = Number(GUICtrlRead($cutNameRight)) $Label_IdentityExample = GUICtrlCreateLabel("Example first file:", 30, 475) GUICtrlSetState(-1, $GUI_DISABLE) $String_FirstFile = "This will show the first file" $Label_FirstFile = GUICtrlCreateLabel($String_FirstFile, 120, 475, 180, 15) GUICtrlSetState(-1, $GUI_DISABLE) $Label_IdentityPortion = GUICtrlCreateLabel("Identical portion:", 30, 495) GUICtrlSetState(-1, $GUI_DISABLE) $String_Portion = "This will show the portion to compare" $Label_Portion = GUICtrlCreateLabel($String_Portion, 120, 495, 180, 15) GUICtrlSetState(-1, $GUI_DISABLE) $compareLogical = GUICtrlCreateRadio("Logical Comparison", 45, 520, 110, 15) GUICtrlSetState(-1, $GUI_DISABLE) $comparePortion = GUICtrlCreateRadio("Compare Using Portion", 165, 520, 130, 15) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState($compareLogical, $GUI_CHECKED) ; Again, need for this section as we are still in the fixed section from way earlier ;$imgOutput_Section = _GUIExtender_Section_Create($mainWin, 555, 50) $Test_Output = GUICtrlCreateCheckbox("Output a Single Frame at a defined time", 50, 560, 220, 20) GUICtrlSetState(-1, $GUI_UNCHECKED) ; Only here do we need to start the next active section as everything above is fixed since the first active section $img_Section = _GUIExtender_Section_Create($mainWin, -1, 170) GUICtrlCreateLabel("", 0, 580, 10, 170) GUICtrlSetBkColor(-1, 0x00FF00) ; Activate this section only vis program calls _GUIExtender_Section_Activate($mainWin, $img_Section) GUICtrlCreateGroup("Output Images Folder", 20, 590, 300, 150) ; Output Folder Button $Control_OutputImageFolderButton = GUICtrlCreateButton("Select Output Images Folder", 60, 610, 220, 25) GUICtrlSetState(-1, $GUI_DISABLE) $String_OutputImageFolder = "not set" $Label_OutputImageFolder = GUICtrlCreateLabel($String_OutputImageFolder, 30, 640, 280, 15, $SS_CENTER) GUICtrlSetState(-1, $GUI_DISABLE) $Label_OutputTime1 = GUICtrlCreateLabel("Defined Time:", 80, 660) GUICtrlSetState(-1, $GUI_DISABLE) $Label_OutputTime2 = GUICtrlCreateLabel("Seconds", 195, 660) GUICtrlSetState(-1, $GUI_DISABLE) $OutputTime = GUICtrlCreateInput("4", 10, 10, 50, 20) GUICtrlSetState(-1, $GUI_DISABLE) $OutputTimeSpinner = GUICtrlCreateUpdown($OutputTime) GUICtrlSetPos($OutputTime, 150, 658, 40, 20) $Label_FileFolder = GUICtrlCreateLabel("Subfolder names start at:", 30, 692) GUICtrlSetState(-1, $GUI_DISABLE) $cutFileFolderName = GUICtrlCreateInput("5", 10, 10, 50, 20, $ES_NUMBER) GUICtrlSetState(-1, $GUI_DISABLE) $cutFileFolderNameSpinner = GUICtrlCreateUpdown($cutFileFolderName) GUICtrlSetLimit(-1, 100, 0) GUICtrlSetPos($cutFileFolderName, 160, 690, 40, 20) GUICtrlSetState(-1, $GUI_DISABLE) Local $cutFileFolder = Number(GUICtrlRead($cutFileFolderName)) $Label_FileFolderExample = GUICtrlCreateLabel("Subfolder of first file:", 30, 715) GUICtrlSetState(-1, $GUI_DISABLE) $String_FirstFileFolder = "This will show the first File-Folder" $Label_FirstFileFolder = GUICtrlCreateLabel($String_FirstFileFolder, 130, 715, 180, 15) GUICtrlSetState(-1, $GUI_DISABLE) ; And now a final fixed section until the end of the GUI $end_Section = _GUIExtender_Section_Create($mainWin, -1, -1) GUICtrlCreateLabel("", 0 , 750, 10, 125) GUICtrlSetBkColor(-1,0xFF0000) $Testbutton = GUICtrlCreateCheckbox("RUN TESTS", 120, 750, 100, 40, $BS_PUSHLIKE) $String_Progress = "Awaiting..." $Label_Progress = GUICtrlCreateLabel($String_Progress, 75, 795, 200, 15, $SS_CENTER) $String_Counter = "" $Label_Counter = GUICtrlCreateLabel($String_Counter, 240, 795, 80, 15, $SS_RIGHT) $ProgressBarTest = GUICtrlCreateProgress(20, 815, 300, 8) GUICtrlSetColor($ProgressBarTest,0x0099ff) $ProgressBarAll = GUICtrlCreateProgress(20, 828, 300, 10) GUICtrlSetColor($ProgressBarAll,0x00ff00) $ProgressBarSubfolders = GUICtrlCreateProgress(20, 843, 300, 6) GUICtrlSetColor($ProgressBarSubfolders,0xff0000) _GUIExtender_Section_Create($mainWin, -99) GUICtrlCreateGroup("", -99, -99, 1, 1) ; Retract all extendable sections _GUIExtender_Section_Action($mainWin, 0, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $cDummyInput GuiCtrlSetData($BadFramesThreshold, $iInitialValue + GuiCtrlRead($cDummyInput) * $iIncrement) Case $Test_Output If GUICtrlRead($Test_Output) = $GUI_CHECKED Then ; Display section _GUIExtender_Section_Action($mainWin, $img_Section) Else ; Hide section _GUIExtender_Section_Action($mainWin, $img_Section, 0) EndIf ; Case $Test_Length OR $Test_Size OR $Test_Resolution OR $Test_Missing ; using "OR" seems to get the UI to flicker... Case $Test_Length If GUICtrlRead($Test_Length) = $GUI_CHECKED Then MasterMovieSectionEnable() Else MasterMovieSectionDisable() EndIf Case $Test_Size If GUICtrlRead($Test_Size) = $GUI_CHECKED Then MasterMovieSectionEnable() Else MasterMovieSectionDisable() EndIf Case $Test_Resolution If GUICtrlRead($Test_Resolution) = $GUI_CHECKED Then MasterMovieSectionEnable() Else MasterMovieSectionDisable() EndIf Case $Test_Missing If GUICtrlRead($Test_Missing) = $GUI_CHECKED Then MasterMovieSectionEnable() Else MasterMovieSectionDisable() EndIf Case $TestMethodSingle ;And BitAND(GUICtrlRead($TestMethodSingle), $GUI_CHECKED) = $GUI_CHECKED ; adding this causes flickers if $TestSingleFolderSelection == false Then GUICtrlSetData($Control_MovieFolderButton, "Select Test Movie Folder") GUICtrlSetState($Label_DirLevel, $GUI_DISABLE) GUICtrlSetState($DirLevel, $GUI_DISABLE) GUICtrlSetState($DirLevelSpinner, $GUI_DISABLE) GUICtrlSetState($Hide_Reports, $GUI_DISABLE) GUICtrlSetData($Label_FirstFileFolder, "This will show the first File-Folder") GUICtrlSetData($Label_FoundFiles, "") GUICtrlSetData($Label_MovieFolder, "not set") EndIf Case $TestMethodRoot ;And BitAND(GUICtrlRead($TestMethodRoot), $GUI_CHECKED) = $GUI_CHECKED ; adding this causes flickers if $TestSingleFolderSelection == true Then GUICtrlSetData($Control_MovieFolderButton, "Select Test Movies Root Folder") GUICtrlSetState($Label_DirLevel, $GUI_ENABLE) GUICtrlSetState($DirLevel, $GUI_ENABLE) GUICtrlSetState($DirLevelSpinner, $GUI_ENABLE) GUICtrlSetState($Hide_Reports, $GUI_ENABLE) GUICtrlSetData($Label_FirstFileFolder, "This will show the first File-Folder") GUICtrlSetData($Label_FoundFiles, "") GUICtrlSetData($Label_MovieFolder, "not set") EndIf EndSwitch _GUIExtender_EventMonitor($mainWin, $nMsg) WEnd Func MasterMovieSectionEnable() GUICtrlSetState($Control_MasterMovieFolderButton, $GUI_ENABLE) GUICtrlSetState($Label_MasterMovieFolder, $GUI_ENABLE) GUICtrlSetState($cutNameLeft, $GUI_ENABLE) GUICtrlSetState($cutNameLeftSpinner, $GUI_ENABLE) GUICtrlSetState($cutNameRight, $GUI_ENABLE) GUICtrlSetState($cutNameRightSpinner, $GUI_ENABLE) GUICtrlSetState($Label_FirstFile, $GUI_ENABLE) GUICtrlSetState($Label_Portion, $GUI_ENABLE) GUICtrlSetState($Label_Identity1, $GUI_ENABLE) GUICtrlSetState($Label_Identity2, $GUI_ENABLE) GUICtrlSetState($Label_IdentityExample, $GUI_ENABLE) GUICtrlSetState($Label_IdentityPortion, $GUI_ENABLE) GUICtrlSetState($compareLogical, $GUI_ENABLE) GUICtrlSetState($comparePortion, $GUI_ENABLE) GUICtrlSetState($Label_MasterFoundFiles, $GUI_ENABLE) EndFunc Func MasterMovieSectionDisable() GUICtrlSetState($Control_MasterMovieFolderButton, $GUI_DISABLE) GUICtrlSetState($Label_MasterMovieFolder, $GUI_DISABLE) GUICtrlSetState($cutNameLeft, $GUI_DISABLE) GUICtrlSetState($cutNameLeftSpinner, $GUI_DISABLE) GUICtrlSetState($cutNameRight, $GUI_DISABLE) GUICtrlSetState($cutNameRightSpinner, $GUI_DISABLE) GUICtrlSetState($Label_FirstFile, $GUI_DISABLE) GUICtrlSetState($Label_Portion, $GUI_DISABLE) GUICtrlSetState($Label_Identity1, $GUI_DISABLE) GUICtrlSetState($Label_Identity2, $GUI_DISABLE) GUICtrlSetState($Label_IdentityExample, $GUI_DISABLE) GUICtrlSetState($Label_IdentityPortion, $GUI_DISABLE) GUICtrlSetState($compareLogical, $GUI_DISABLE) GUICtrlSetState($comparePortion, $GUI_DISABLE) GUICtrlSetState($Label_MasterFoundFiles, $GUI_DISABLE) EndFunc