├── .gitattributes ├── .gitignore ├── Include ├── _ArrayMultiColSort.au3 ├── _ExtMsgBox.au3 ├── _GUIListViewEx.au3 ├── _MultiLang.au3 └── _Trim.au3 ├── LanguageFiles ├── URC-ENGLISH.XML ├── URC-FRENCH.XML ├── URC-GERMAN.XML └── URC-SPANISH.XML ├── MakeFakeFile.exe ├── README.md ├── Ressources └── Universal_Rom_Cleaner.ico ├── URC-config.ini └── Universal ROM Cleaner.au3 /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # BackUp file 2 | *_old*.au3 3 | 4 | # Test file 5 | simulation.txt 6 | 7 | # Windows image file caches 8 | Thumbs.db 9 | ehthumbs.db 10 | 11 | # Folder config file 12 | Desktop.ini 13 | 14 | # Recycle Bin used on file shares 15 | $RECYCLE.BIN/ 16 | 17 | # Windows Installer files 18 | *.cab 19 | *.msi 20 | *.msm 21 | *.msp 22 | 23 | # Windows shortcuts 24 | *.lnk 25 | 26 | # ========================= 27 | # Operating System Files 28 | # ========================= 29 | 30 | # OSX 31 | # ========================= 32 | 33 | .DS_Store 34 | .AppleDouble 35 | .LSOverride 36 | 37 | # Thumbnails 38 | ._* 39 | 40 | # Files that might appear in the root of a volume 41 | .DocumentRevisions-V100 42 | .fseventsd 43 | .Spotlight-V100 44 | .TemporaryItems 45 | .Trashes 46 | .VolumeIcon.icns 47 | 48 | # Directories potentially created on remote AFP share 49 | .AppleDB 50 | .AppleDesktop 51 | Network Trash Folder 52 | Temporary Items 53 | .apdisk 54 | test.au3 55 | simulation.csv 56 | ATTRIB.txt 57 | FileList.txt 58 | IGNORE.txt 59 | SUPPR.txt 60 | -------------------------------------------------------------------------------- /Include/_ArrayMultiColSort.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ;#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 4 | 5 | ; #INCLUDES# ========================================================================================================= 6 | #include 7 | ; =============================================================================================================================== 8 | 9 | ; #INDEX# ======================================================================================================================= 10 | ; Title .........: ArrayMultiColSort 11 | ; AutoIt Version : v3.3.8.1 or higher 12 | ; Language ......: English 13 | ; Description ...: Sorts 2D arrays on several columns 14 | ; Note ..........: 15 | ; Author(s) .....: Melba23 16 | ; Remarks .......: 17 | ; =============================================================================================================================== 18 | 19 | ; #CURRENT# ===================================================================================================================== 20 | ; _ArrayMultiColSort : Sort 2D arrays on several columns 21 | ; =============================================================================================================================== 22 | 23 | ; #INTERNAL_USE_ONLY#================================================================================================= 24 | ; __AMCS_SortChunk : Sorts array section 25 | ; =============================================================================================================================== 26 | 27 | ; #FUNCTION# ==================================================================================================================== 28 | ; Name...........: _ArrayMultiColSort 29 | ; Description ...: Sort 2D arrays on several columns 30 | ; Syntax.........: _ArrayMultiColSort(ByRef $aArray, $aSortData[, $iStart = 0[, $iEnd = 0]]) 31 | ; Parameters ....: $aArray - The 2D array to be sorted 32 | ; $aSortData - 2D array holding details of the sort format 33 | ; Format: [Column to be sorted, Sort order] 34 | ; Sort order can be either numeric (0/1 = ascending/descending) or a ordered string of items 35 | ; Any elements not matched in string are left unsorted after all sorted elements 36 | ; $iStart - Element of array at which sort starts (default = 0) 37 | ; $iEnd - Element of array at which sort endd (default = 0 - converted to end of array) 38 | ; Requirement(s).: v3.3.8.1 or higher 39 | ; Return values .: Success: No error 40 | ; Failure: @error set as follows 41 | ; @error = 1 with @extended set as follows (all refer to $sIn_Date): 42 | ; 1 = Array to be sorted not 2D 43 | ; 2 = Sort data array not 2D 44 | ; 3 = More data rows in $aSortData than columns in $aArray 45 | ; 4 = Start beyond end of array 46 | ; 5 = Start beyond End 47 | ; @error = 2 with @extended set as follows: 48 | ; 1 = Invalid string parameter in $aSortData 49 | ; 2 = Invalid sort direction parameter in $aSortData 50 | ; Author ........: Melba23 51 | ; Remarks .......: Columns can be sorted in any order 52 | ; Example .......; Yes 53 | ; =============================================================================================================================== 54 | Func _ArrayMultiColSort(ByRef $aArray, $aSortData, $iStart = 0, $iEnd = 0) 55 | 56 | ; Errorchecking 57 | ; 2D array to be sorted 58 | If UBound($aArray, 2) = 0 Then 59 | Return SetError(1, 1, "") 60 | EndIf 61 | ; 2D sort data 62 | If UBound($aSortData, 2) <> 2 Then 63 | Return SetError(1, 2, "") 64 | EndIf 65 | If UBound($aSortData) > UBound($aArray) Then 66 | Return SetError(1, 3) 67 | EndIf 68 | ; Start element 69 | If $iStart < 0 Then 70 | $iStart = 0 71 | EndIf 72 | If $iStart >= UBound($aArray) - 1 Then 73 | Return SetError(1, 4, "") 74 | EndIf 75 | ; End element 76 | If $iEnd <= 0 Or $iEnd >= UBound($aArray) - 1 Then 77 | $iEnd = UBound($aArray) - 1 78 | EndIf 79 | ; Sanity check 80 | If $iEnd <= $iStart Then 81 | Return SetError(1, 5, "") 82 | EndIf 83 | 84 | Local $iCurrCol, $iChunk_Start, $iMatchCol 85 | 86 | ; Sort first column 87 | __AMCS_SortChunk($aArray, $aSortData, 0, $aSortData[0][0], $iStart, $iEnd) 88 | If @error Then 89 | Return SetError(2, @extended, "") 90 | EndIf 91 | ; Now sort within other columns 92 | For $iSortData_Row = 1 To UBound($aSortData) - 1 93 | ; Determine column to sort 94 | $iCurrCol = $aSortData[$iSortData_Row][0] 95 | ; Create arrays to hold data from previous columns 96 | Local $aBaseValue[$iSortData_Row] 97 | ; Set base values 98 | For $i = 0 To $iSortData_Row - 1 99 | $aBaseValue[$i] = $aArray[$iStart][$aSortData[$i][0]] 100 | Next 101 | ; Set start of this chunk 102 | $iChunk_Start = $iStart 103 | ; Now work down through array 104 | For $iRow = $iStart + 1 To $iEnd 105 | ; Match each column 106 | For $k = 0 To $iSortData_Row - 1 107 | $iMatchCol = $aSortData[$k][0] 108 | ; See if value in each has changed 109 | If $aArray[$iRow][$iMatchCol] <> $aBaseValue[$k] Then 110 | ; If so and row has advanced 111 | If $iChunk_Start < $iRow - 1 Then 112 | ; Sort this chunk 113 | __AMCS_SortChunk($aArray, $aSortData, $iSortData_Row, $iCurrCol, $iChunk_Start, $iRow - 1) 114 | If @error Then 115 | Return SetError(2, @extended, "") 116 | EndIf 117 | EndIf 118 | ; Set new base value 119 | $aBaseValue[$k] = $aArray[$iRow][$iMatchCol] 120 | ; Set new chunk start 121 | $iChunk_Start = $iRow 122 | EndIf 123 | Next 124 | Next 125 | ; Sort final section 126 | If $iChunk_Start < $iRow - 1 Then 127 | __AMCS_SortChunk($aArray, $aSortData, $iSortData_Row, $iCurrCol, $iChunk_Start, $iRow - 1) 128 | If @error Then 129 | Return SetError(2, @extended, "") 130 | EndIf 131 | EndIf 132 | Next 133 | 134 | EndFunc ;==>_ArrayMultiColSort 135 | 136 | ; #INTERNAL_USE_ONLY# =========================================================================================================== 137 | ; Name...........: __AMCS_SortChunk 138 | ; Description ...: Sorts array section 139 | ; Author ........: Melba23 140 | ; Remarks .......: 141 | ; =============================================================================================================================== 142 | Func __AMCS_SortChunk(ByRef $aArray, $aSortData, $iRow, $iColumn, $iChunkStart, $iChunkEnd) 143 | 144 | Local $aSortOrder 145 | 146 | ; Set default sort direction 147 | Local $iSortDirn = 1 148 | ; Need to prefix elements? 149 | If IsString($aSortData[$iRow][1]) Then 150 | ; Split elements 151 | $aSortOrder = StringSplit($aSortData[$iRow][1], ",") 152 | If @error Then 153 | Return SetError(1, 1, "") 154 | EndIf 155 | ; Add prefix to each element 156 | For $i = $iChunkStart To $iChunkEnd 157 | For $j = 1 To $aSortOrder[0] 158 | If $aArray[$i][$iColumn] = $aSortOrder[$j] Then 159 | $aArray[$i][$iColumn] = StringFormat("%02i-", $j) & $aArray[$i][$iColumn] 160 | ExitLoop 161 | EndIf 162 | Next 163 | ; Deal with anything that does not match 164 | If $j > $aSortOrder[0] Then 165 | $aArray[$i][$iColumn] = StringFormat("%02i-", $j) & $aArray[$i][$iColumn] 166 | EndIf 167 | Next 168 | Else 169 | Switch $aSortData[$iRow][1] 170 | Case 0, 1 171 | ; Set required sort direction if no list 172 | If $aSortData[$iRow][1] Then 173 | $iSortDirn = -1 174 | Else 175 | $iSortDirn = 1 176 | EndIf 177 | Case Else 178 | Return SetError(1, 2, "") 179 | EndSwitch 180 | EndIf 181 | 182 | ; Sort the chunk 183 | Local $iSubMax = UBound($aArray, 2) - 1 184 | __ArrayQuickSort2D($aArray, $iSortDirn, $iChunkStart, $iChunkEnd, $iColumn, $iSubMax) 185 | 186 | ; Remove any prefixes 187 | If IsString($aSortData[$iRow][1]) Then 188 | For $i = $iChunkStart To $iChunkEnd 189 | $aArray[$i][$iColumn] = StringTrimLeft($aArray[$i][$iColumn], 3) 190 | Next 191 | EndIf 192 | 193 | EndFunc ;==>__AMCS_SortChunk 194 | -------------------------------------------------------------------------------- /Include/_ExtMsgBox.au3: -------------------------------------------------------------------------------- 1 | #include-once 2 | 3 | ; #INDEX# ============================================================================================================ 4 | ; Title .........: ExtMsgBox 5 | ; AutoIt Version : v3.2.12.1 or higher 6 | ; Language ......: English 7 | ; Description ...: Generates user defined message boxes centred on a GUI, on screen or at defined coordinates 8 | ; Remarks .......: 9 | ; Note ..........: 10 | ; Author(s) .....: Melba23, based on some original code by photonbuddy & YellowLab, and KaFu (default font data) 11 | ; ==================================================================================================================== 12 | 13 | ;#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w- 7 14 | 15 | ; #INCLUDES# ========================================================================================================= 16 | #include "StringSize.au3" 17 | 18 | ; #GLOBAL CONSTANTS# ================================================================================================= 19 | Global Const $EMB_ICONSTOP = 16 ; Stop-sign icon 20 | Global Const $EMB_ICONQUERY = 32 ; Question-mark icon 21 | Global Const $EMB_ICONEXCLAM = 48 ; Exclamation-point icon 22 | Global Const $EMB_ICONINFO = 64 ; Icon consisting of an 'i' in a circle 23 | 24 | ; #GLOBAL VARIABLES# ================================================================================================= 25 | 26 | Global $g_aEMB_Settings[13] 27 | ; [0] = Style [6] = Max Width 28 | ; [1] = Justification [7] = Absolute Width 29 | ; [2] = Back Colour [8] = Default Back Colour 30 | ; [3] = Text Colour [9] = Default Text Colour 31 | ; [4] = Font Size [10] = Default Font Size 32 | ; [5] = Font Name [11] = Default Font Name 33 | ; [12] = Title bar reduction 34 | 35 | ; Default settings 36 | ; Font 37 | Global $g_aEMB_TempArray = __EMB_GetDefaultFont() 38 | $g_aEMB_Settings[10] = $g_aEMB_TempArray[0] 39 | $g_aEMB_Settings[11] = $g_aEMB_TempArray[1] 40 | ; Colours 41 | $g_aEMB_TempArray = DllCall("User32.dll", "int", "GetSysColor", "int", 15) ; $COLOR_3DFACE 42 | $g_aEMB_Settings[8] = BitAND(BitShift(String(Binary($g_aEMB_TempArray[0])), 8), 0xFFFFFF) 43 | $g_aEMB_TempArray = DllCall("User32.dll", "int", "GetSysColor", "int", 8) ; $COLOR_WINDOWTEXT 44 | $g_aEMB_Settings[9] = BitAND(BitShift(String(Binary($g_aEMB_TempArray[0])), 8), 0xFFFFFF) 45 | ; Title bar width reduction by icon and [X] button in various themes 46 | $g_aEMB_TempArray = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 11) ; Title bar icon width 47 | $g_aEMB_Settings[12] = $g_aEMB_TempArray[0] 48 | $g_aEMB_TempArray = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 30) ; Title bar button width 49 | $g_aEMB_Settings[12] += ( ($g_aEMB_TempArray[0] < 30) ? ($g_aEMB_TempArray[0] * 3) : ($g_aEMB_TempArray[0]) ) ; Compensate for small buttons in some themes 50 | $g_aEMB_TempArray = 0 51 | $g_aEMB_TempArray = DllCall("dwmapi.dll", "uint", "DwmIsCompositionEnabled", "int*", $g_aEMB_TempArray) ; Check for Aero enabled 52 | If Not @error And $g_aEMB_TempArray[1] = True Then 53 | $g_aEMB_TempArray = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 7) ; GUI button frame width 54 | $g_aEMB_Settings[12] += ($g_aEMB_TempArray[0] * 4) ; Add frames to compensate for incorrect Aero return 55 | EndIf 56 | $g_aEMB_TempArray = 0 57 | 58 | ; Set current settings 59 | $g_aEMB_Settings[0] = 0 60 | $g_aEMB_Settings[1] = 0 61 | $g_aEMB_Settings[2] = $g_aEMB_Settings[8] 62 | $g_aEMB_Settings[3] = $g_aEMB_Settings[9] 63 | $g_aEMB_Settings[4] = $g_aEMB_Settings[10] 64 | $g_aEMB_Settings[5] = $g_aEMB_Settings[11] 65 | $g_aEMB_Settings[6] = 370 66 | $g_aEMB_Settings[7] = 500 67 | 68 | ; #CURRENT# ========================================================================================================== 69 | ; _ExtMsgBoxSet: Sets the GUI style, justification, colours, font and max width for subsequent _ExtMsgBox function calls 70 | ; _ExtMsgBox: Generates user defined message boxes centred on a GUI, on screen or at defined coordinates 71 | ; ==================================================================================================================== 72 | 73 | ; #INTERNAL_USE_ONLY#================================================================================================= 74 | ; __EMB_GetDefaultFont: Determines Windows default MsgBox font size and name 75 | ; ==================================================================================================================== 76 | 77 | ; #FUNCTION# ========================================================================================================= 78 | ; Name...........: _ExtMsgBoxSet 79 | ; Description ...: Sets the GUI style, justification, colours, font and max width for subsequent _ExtMsgBox function calls 80 | ; Syntax.........: _ExtMsgBoxSet($iStyle, $iJust, [$iBkCol, [$iCol, [$sFont_Size, [$iFont_Name, [$iWidth, [ $iWidth_Abs]]]]]]) 81 | ; Parameters ....: $iStyle -> 0 (Default) - Taskbar Button, TOPMOST, button in user font, no tab expansion, 82 | ; no checkbox, titlebar icon, active closure [X] and SysMenu close 83 | ; Combine following to change: 84 | ; 1 = No Taskbar Button 85 | ; 2 = TOPMOST Style not set 86 | ; 4 = Buttons use default font 87 | ; 8 = Expand Tabs to ensure adequate sizing of GUI 88 | ; 16 = "Do not display again" checkbox 89 | ; 32 = Show no icon on title bar 90 | ; 64 = Disable EMB closure [X] and SysMenu Close 91 | ; $iJust -> 0 = Left justified (Default), 1 = Centred , 2 = Right justified 92 | ; + 4 = Centred single button. Note: multiple buttons are always centred 93 | ; ($SS_LEFT, $SS_CENTER, $SS_RIGHT can also be used) 94 | ; $iBkCol -> The colour for the message box background. Default = system colour 95 | ; $iCol -> The colour for the message box text. Default = system colour 96 | ; $iFont_Size -> The font size in points to use for the message box. Default = system font size 97 | ; $sFont_Name -> The font to use for the message box. Default = system font 98 | ; $iWidth -> Normal max width for EMB. Default/min = 370 pixels - max = @DesktopWidth - 20 99 | ; $iWidth_Abs -> Absolute max width for EMB. Default/min = 370 pixels - max = @DesktopWidth - 20 100 | ; EMB will expand to this value to accommodate long unbroken character strings 101 | ; Forced to $iWidth value if less 102 | ; Requirement(s).: v3.2.12.1 or higher 103 | ; Return values .: Success - Returns 1 104 | ; Failure - Returns 0 and sets @error to 1 with @extended set to incorrect parameter index number 105 | ; Remarks .......; Setting any parameter to -1 leaves the current value unchanged 106 | ; Setting the $iStyle parameter to 'Default' resets ALL parameters to default values <<<<<<<<<<<<<<<<<<<<<<< 107 | ; Setting any other parameter to "Default" only resets that parameter 108 | ; Author ........: Melba23 109 | ; Example........; Yes 110 | ;===================================================================================================================== 111 | Func _ExtMsgBoxSet($iStyle = -1, $iJust = -1, $iBkCol = -1, $iCol = -1, $iFont_Size = -1, $sFont_Name = -1, $iWidth = -1, $iWidth_Abs = -1) 112 | 113 | ; Set global EMB variables to required values 114 | Switch $iStyle 115 | Case Default 116 | $g_aEMB_Settings[0] = 0 117 | $g_aEMB_Settings[1] = 0 118 | $g_aEMB_Settings[2] = $g_aEMB_Settings[8] 119 | $g_aEMB_Settings[3] = $g_aEMB_Settings[9] 120 | $g_aEMB_Settings[5] = $g_aEMB_Settings[11] 121 | $g_aEMB_Settings[4] = $g_aEMB_Settings[10] 122 | $g_aEMB_Settings[6] = 370 123 | $g_aEMB_Settings[7] = 370 124 | Return 125 | Case -1 126 | ; Do nothing 127 | Case 0 To 127 128 | $g_aEMB_Settings[0] = Int($iStyle) 129 | Case Else 130 | Return SetError(1, 1, 0) 131 | EndSwitch 132 | 133 | Switch $iJust 134 | Case Default 135 | $g_aEMB_Settings[1] = 0 136 | Case -1 137 | ; Do nothing 138 | Case 0, 1, 2, 4, 5, 6 139 | $g_aEMB_Settings[1] = $iJust 140 | Case Else 141 | Return SetError(1, 2, 0) 142 | EndSwitch 143 | 144 | Switch $iBkCol 145 | Case Default 146 | $g_aEMB_Settings[2] = $g_aEMB_Settings[8] 147 | Case -1 148 | ; Do nothing 149 | Case 0 To 0xFFFFFF 150 | $g_aEMB_Settings[2] = Int($iBkCol) 151 | Case Else 152 | Return SetError(1, 3, 0) 153 | EndSwitch 154 | 155 | Switch $iCol 156 | Case Default 157 | $g_aEMB_Settings[3] = $g_aEMB_Settings[9] 158 | Case -1 159 | ; Do nothing 160 | Case 0 To 0xFFFFFF 161 | $g_aEMB_Settings[3] = Int($iCol) 162 | Case Else 163 | Return SetError(1, 4, 0) 164 | EndSwitch 165 | 166 | Switch $iFont_Size 167 | Case Default 168 | $g_aEMB_Settings[4] = $g_aEMB_Settings[10] 169 | Case -1 170 | ; Do nothing 171 | Case 8 To 72 172 | $g_aEMB_Settings[4] = Int($iFont_Size) 173 | Case Else 174 | Return SetError(1, 5, 0) 175 | EndSwitch 176 | 177 | Switch $sFont_Name 178 | Case Default 179 | $g_aEMB_Settings[5] = $g_aEMB_Settings[11] 180 | Case -1 181 | ; Do nothing 182 | Case Else 183 | If IsString($sFont_Name) Then 184 | $g_aEMB_Settings[5] = $sFont_Name 185 | Else 186 | Return SetError(1, 6, 0) 187 | EndIf 188 | EndSwitch 189 | 190 | Switch $iWidth 191 | Case Default 192 | $g_aEMB_Settings[6] = 370 193 | Case -1 194 | ; Do nothing 195 | Case 370 To @DesktopWidth - 20 196 | $g_aEMB_Settings[6] = Int($iWidth) 197 | Case Else 198 | Return SetError(1, 7, 0) 199 | EndSwitch 200 | 201 | Switch $iWidth_Abs 202 | Case Default 203 | $g_aEMB_Settings[7] = 370 204 | Case -1 205 | ; Do nothing 206 | Case 370 To @DesktopWidth - 20 207 | $g_aEMB_Settings[7] = Int($iWidth_Abs) 208 | Case Else 209 | Return SetError(1, 8, 0) 210 | EndSwitch 211 | 212 | ; Check absolute width is at least max width 213 | If $g_aEMB_Settings[7] < $g_aEMB_Settings[6] Then 214 | $g_aEMB_Settings[7] = $g_aEMB_Settings[6] 215 | EndIf 216 | 217 | Return 1 218 | 219 | EndFunc ;==>_ExtMsgBoxSet 220 | 221 | ; #FUNCTION# ========================================================================================================= 222 | ; Name...........: _ExtMsgBox 223 | ; Description ...: Generates user defined message boxes centred on a GUI, the desktop, or at defined coordinates 224 | ; Syntax.........: _ExtMsgBox ($vIcon, $vButton, $sTitle, $sText, [$iTimeout, [$hWin, [$iVPos, [$bMain = True[]]]) 225 | ; Parameters ....: $vIcon -> Icon to use: 226 | ; 0 - No icon 227 | ; 8 - UAC 228 | ; 16 - Stop ) 229 | ; 32 - Query ) or equivalent $MB/$EMB_ICON constant 230 | ; 48 - Exclamation ) 231 | ; 64 - Information ) 232 | ; 128 - Countdown digits if $iTimeout set 233 | ; Any other numeric value returns Error 1 234 | ; Full path and name of exe - main exe icon displayed 235 | ; Full path and name of icon - icon displayed 236 | ; $vButton -> Button text separated with "|" character. " " = no buttons. 237 | ; An ampersand (&) before the text indicates the default button. 238 | ; Two focus ampersands returns Error 2. A single button is always default 239 | ; Pressing Enter or Space fires default button 240 | ; Can also use $MB_ button numeric constants: 0 = "OK", 1 = "&OK|Cancel", 241 | ; 2 = "&Abort|Retry|Ignore", 3 = "&Yes|No|Cancel", 4 = "&Yes|No", 5 = "&Retry|Cancel", 242 | ; 6 = "&Cancel|Try Again|Continue". Other values returns Error 3 243 | ; Default max width of 370 gives 1-4 buttons @ width 80, 5 @ width 60, 6 @ width 50 244 | ; Min button width set at 50, so unless defaults changed 7 buttons returns Error 4 245 | ; $sTitle -> The title of the message box. 246 | ; Procrustean truncation if too long to fit 247 | ; $sText -> The text to be displayed. Long lines will wrap. The box depth is adjusted to fit. 248 | ; If unbroken character strings in $sText too long for set max width, 249 | ; EMB expands to set absolute width. Error 6 if still not able to fit 250 | ; $iTimeout -> Timeout delay before EMB closes. 0 = no timeout (Default). 251 | ; If no buttons and no timeout set, delay automatically set to 5 252 | ; $hWin -> Handle of the GUI in which EMB is centred 253 | ; If GUI hidden or no handle passed - EMB centred in desktop (Default) 254 | ; If not valid window handle, interpreted as horizontal coordinate for EMB location 255 | ; $iVPos -> Vertical coordinate for EMB location 256 | ; Only valid if $hWin parameter interpreted as horizontal coordinate (Default = 0) 257 | ; $bMain -> True (default) = Adjust dialog position to ensure dialog positioned on main screen 258 | ; False = Dialog positioned at defined coords 259 | ; Requirement(s).: v3.2.12.1 or higher 260 | ; Return values .: Success: Returns 1-based index of the button pressed, counting from the LEFT. 261 | ; Returns 0 if closed by a "CloseGUI" event (i.e. click [X] or press Escape) 262 | ; Returns 9 if timed out 263 | ; If "Not again" checkbox is present and checked, return value is negated 264 | ; Failure: Returns -1 and sets @error as follows: 265 | ; 1 - Icon error 266 | ; 2 - Multiple default button error 267 | ; 3 - Button constant error 268 | ; 4 - Too many buttons to fit in max available EMB width 269 | ; 5 - Button text too long for max available button width 270 | ; 6 - StringSize error 271 | ; 7 - GUI creation error 272 | ; Remarks .......; If $bMain set EMB adjusted to appear on main screen closest to required position 273 | ; Author ........: Melba23, based on some original code by photonbuddy & YellowLab 274 | ; Example........; Yes 275 | ;===================================================================================================================== 276 | Func _ExtMsgBox($vIcon, $vButton, $sTitle, $sText, $iTimeOut = 0, $hWin = "", $iVPos = 0, $bMain = True) 277 | 278 | ; Set default sizes for message box 279 | Local $iMsg_Width_Max = $g_aEMB_Settings[6], $iMsg_Width_Min = 150, $iMsg_Width_Abs = $g_aEMB_Settings[7] 280 | Local $iMsg_Height_Min = 100 281 | Local $iButton_Width_Def = 80, $iButton_Width_Min = 50 282 | 283 | ; Declare local variables 284 | Local $iParent_Win = 0, $fCountdown = False, $cCheckbox, $aLabel_Size, $aRet, $iRet_Value, $iHpos 285 | Local $sButton_Text, $iButton_Width_Req, $iButton_Width, $iButton_Xpos 286 | 287 | ; Validate timeout value 288 | $iTimeOut = Int(Number($iTimeOut)) 289 | ; Set automatic timeout if no buttons and no timeout set 290 | If $vButton == " " And $iTimeOut = 0 Then 291 | $iTimeOut = 5 292 | EndIf 293 | 294 | ; Check for icon 295 | Local $iIcon_Style = 0 296 | Local $iIcon_Reduction = 50 297 | Local $sDLL = "user32.dll" 298 | If StringIsDigit($vIcon) Then 299 | Switch $vIcon 300 | Case 0 301 | $iIcon_Reduction = 0 302 | Case 8 303 | $sDLL = "imageres.dll" 304 | $iIcon_Style = 78 305 | Case 16 ; Stop 306 | $iIcon_Style = -4 307 | Case 32 ; Query 308 | $iIcon_Style = -3 309 | Case 48 ; Exclam 310 | $iIcon_Style = -2 311 | Case 64 ; Info 312 | $iIcon_Style = -5 313 | Case 128 ; Countdown 314 | If $iTimeOut > 0 Then 315 | $fCountdown = True 316 | Else 317 | ContinueCase 318 | EndIf 319 | Case Else 320 | Return SetError(1, 0, -1) 321 | EndSwitch 322 | Else 323 | $sDLL = $vIcon 324 | $iIcon_Style = 0 325 | EndIf 326 | 327 | ; Check if two buttons are seeking focus 328 | StringRegExpReplace($vButton, "((? 1 Then 330 | Return SetError(2, 0, -1) 331 | EndIf 332 | 333 | ; Check if using constants or text 334 | If IsNumber($vButton) Then 335 | Switch $vButton 336 | Case 0 337 | $vButton = "OK" 338 | Case 1 339 | $vButton = "&OK|Cancel" 340 | Case 2 341 | $vButton = "&Abort|Retry|Ignore" 342 | Case 3 343 | $vButton = "&Yes|No|Cancel" 344 | Case 4 345 | $vButton = "&Yes|No" 346 | Case 5 347 | $vButton = "&Retry|Cancel" 348 | Case 6 349 | $vButton = "&Cancel|Try Again|Continue" 350 | Case Else 351 | Return SetError(3, 0, -1) 352 | EndSwitch 353 | EndIf 354 | 355 | ; Get required button size 356 | If $vButton <> " " Then 357 | ; Split button text into individual strings 358 | Local $aButton_Text = StringSplit($vButton, "|") 359 | ; Get absolute available width for each button 360 | Local $iButton_Width_Abs = Floor((($iMsg_Width_Max - 10) / $aButton_Text[0]) - 10) 361 | ; Error if below min button size 362 | If $iButton_Width_Abs < $iButton_Width_Min Then 363 | Return SetError(4, 0, -1) 364 | EndIf 365 | ; Determine required size of buttons to fit text 366 | Local $iButton_Width_Text = 0 367 | ; Loop through button text 368 | For $i = 1 To $aButton_Text[0] 369 | ; Remove a possible leading & 370 | $sButton_Text = StringRegExpReplace($aButton_Text[$i], "^&?(.*)$", "$1") 371 | ; Check on font to use 372 | If BitAND($g_aEMB_Settings[0], 4) Then 373 | $aRet = _StringSize($sButton_Text, $g_aEMB_Settings[10], Default, Default, $g_aEMB_Settings[11]) 374 | Else 375 | $aRet = _StringSize($sButton_Text, $g_aEMB_Settings[4], Default, Default, $g_aEMB_Settings[5]) 376 | EndIf 377 | If IsArray($aRet) And $aRet[2] + 10 > $iButton_Width_Text Then 378 | ; Find max button width required for text 379 | $iButton_Width_Text = $aRet[2] + 10 380 | EndIf 381 | Next 382 | ; Error if text would make required button width > absolute available 383 | If $iButton_Width_Text > $iButton_Width_Abs Then 384 | Return SetError(5, 0, -1) 385 | EndIf 386 | ; Determine button size to use - assume default 387 | $iButton_Width = $iButton_Width_Def 388 | ; If text requires wider then default 389 | If $iButton_Width_Text > $iButton_Width_Def Then 390 | ; Increase - cannot be > absolute 391 | $iButton_Width = $iButton_Width_Text 392 | EndIf 393 | ; If absolute < default 394 | If $iButton_Width_Abs < $iButton_Width_Def Then 395 | ; If text > min (text must be < abs) 396 | If $iButton_Width_Text > $iButton_Width_Min Then 397 | ; Set text width 398 | $iButton_Width = $iButton_Width_Text 399 | Else 400 | ; Set min width 401 | $iButton_Width = $iButton_Width_Min 402 | EndIf 403 | EndIf 404 | ; Determine GUI width required for all buttons at this width 405 | $iButton_Width_Req = (($iButton_Width + 10) * $aButton_Text[0]) + 10 406 | Else 407 | $iButton_Width_Req = 0 408 | EndIf 409 | 410 | ; Set tab expansion flag if required 411 | Local $iExpTab = Default 412 | If BitAND($g_aEMB_Settings[0], 8) Then 413 | $iExpTab = 1 414 | EndIf 415 | 416 | ; Get message label size 417 | While 1 418 | Local $aLabel_Pos = _StringSize($sText, $g_aEMB_Settings[4], Default, $iExpTab, $g_aEMB_Settings[5], $iMsg_Width_Max - 20 - $iIcon_Reduction) 419 | If @error Then 420 | If $iMsg_Width_Max >= $iMsg_Width_Abs Then 421 | Return SetError(6, 0, -1) 422 | Else 423 | $iMsg_Width_Max += 10 424 | EndIf 425 | Else 426 | ExitLoop 427 | EndIf 428 | WEnd 429 | ; Reset text to wrapped version 430 | $sText = $aLabel_Pos[0] 431 | ; Set label size 432 | Local $iLabel_Width = $aLabel_Pos[2] 433 | Local $iLabel_Height = $aLabel_Pos[3] 434 | 435 | ; Set GUI size 436 | Local $iMsg_Width = $iLabel_Width + 20 + $iIcon_Reduction 437 | ; Increase width to fit buttons if needed 438 | If $iButton_Width_Req > $iMsg_Width Then $iMsg_Width = $iButton_Width_Req 439 | If $iMsg_Width < $iMsg_Width_Min Then 440 | $iMsg_Width = $iMsg_Width_Min 441 | $iLabel_Width = $iMsg_Width_Min - 20 442 | EndIf 443 | 444 | ; Check if title sets width 445 | Local $iDialog_Width = $iMsg_Width 446 | ; Size title 447 | Local $aTitleSize = _StringSize($sTitle, $g_aEMB_Settings[10], Default, Default, $g_aEMB_Settings[11]) 448 | 449 | ;ConsoleWrite(142 & " - " & $aTitleSize[2] & @CRLF) 450 | ;ConsoleWrite(80 & " - " & $iMsg_Width - 70 & @CRLF) 451 | ;ConsoleWrite(500 & " - " & $g_aEMB_Settings[7] & @CRLF) 452 | ;ConsoleWrite(83 & " - " & $g_aEMB_Settings[12] & @CRLF) 453 | 454 | ; Check if title wider than text 455 | If $aTitleSize[2] > ($iMsg_Width - 70) Then ; Assume icon reduction of 50 regardless of icon setting 456 | ; Adjust dialog width up to absolute dialog width value 457 | $iDialog_Width = ( ($aTitleSize[2] < ($g_aEMB_Settings[7] - $g_aEMB_Settings[12])) ? ($aTitleSize[2] + $g_aEMB_Settings[12]) : ($g_aEMB_Settings[7]) ) 458 | EndIf 459 | 460 | ;ConsoleWrite($iDialog_Width & @CRLF) 461 | 462 | Local $iMsg_Height = $iLabel_Height + 35 463 | ; Increase height if buttons present 464 | If $vButton <> " " Then 465 | $iMsg_Height += 30 466 | EndIf 467 | ; Increase height if checkbox required 468 | If BitAND($g_aEMB_Settings[0], 16) Then 469 | $iMsg_Height += 40 470 | EndIf 471 | If $iMsg_Height < $iMsg_Height_Min Then $iMsg_Height = $iMsg_Height_Min 472 | 473 | ; If only single line, lower label to to centre text on icon 474 | Local $iLabel_Vert = 20 475 | If StringInStr($sText, @CRLF) = 0 Then $iLabel_Vert = 27 476 | 477 | ; Check for taskbar button style required 478 | If Mod($g_aEMB_Settings[0], 2) = 1 Then ; Hide taskbar button so create as child 479 | If IsHWnd($hWin) Then 480 | $iParent_Win = $hWin ; Make child of that window 481 | Else 482 | $iParent_Win = WinGetHandle(AutoItWinGetTitle()) ; Make child of AutoIt window 483 | EndIf 484 | EndIf 485 | 486 | ; Determine EMB location 487 | If $hWin = "" Then 488 | ; No handle or position passed so centre on screen 489 | $iHpos = (@DesktopWidth - $iDialog_Width) / 2 490 | $iVPos = (@DesktopHeight - $iMsg_Height) / 2 491 | Else 492 | If IsHWnd($hWin) Then 493 | ; Get parent GUI pos if visible 494 | If BitAND(WinGetState($hWin), 2) Then 495 | ; Set EMB to centre on parent 496 | Local $aPos = WinGetPos($hWin) 497 | $iHpos = ($aPos[2] - $iDialog_Width) / 2 + $aPos[0] - 3 498 | $iVPos = ($aPos[3] - $iMsg_Height) / 2 + $aPos[1] - 20 499 | Else 500 | ; Set EMB to centre om screen 501 | $iHpos = (@DesktopWidth - $iDialog_Width) / 2 502 | $iVPos = (@DesktopHeight - $iMsg_Height) / 2 503 | EndIf 504 | Else 505 | ; Assume parameter is horizontal coord 506 | $iHpos = $hWin ; $iVpos already set 507 | EndIf 508 | EndIf 509 | 510 | ; If dialog is to appear on main display 511 | If $bMain Then 512 | ; Dialog is visible horizontally 513 | If $iHpos < 10 Then $iHpos = 10 514 | If $iHpos + $iDialog_Width > @DesktopWidth - 20 Then $iHpos = @DesktopWidth - 20 - $iDialog_Width 515 | ; Then vertically 516 | If $iVPos < 10 Then $iVPos = 10 517 | If $iVPos + $iMsg_Height > @DesktopHeight - 60 Then $iVPos = @DesktopHeight - 60 - $iMsg_Height 518 | EndIf 519 | 520 | ; Remove TOPMOST extended style if required 521 | Local $iExtStyle = 0x00000008 ; $WS_TOPMOST 522 | If BitAND($g_aEMB_Settings[0], 2) Then $iExtStyle = -1 523 | 524 | ; Create GUI with $WS_POPUPWINDOW, $WS_CAPTION style and required extended style 525 | Local $hMsgGUI = GUICreate($sTitle, $iDialog_Width, $iMsg_Height, $iHpos, $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, $iParent_Win) 526 | If @error Then 527 | Return SetError(7, 0, -1) 528 | EndIf 529 | 530 | ; Check if titlebar icon hidden - actually uses transparent icon from AutoIt executable 531 | If BitAND($g_aEMB_Settings[0], 32) Then 532 | If @Compiled Then 533 | GUISetIcon(@ScriptName, -2, $hMsgGUI) 534 | Else 535 | GUISetIcon(@AutoItExe, -2, $hMsgGUI) 536 | EndIf 537 | EndIf 538 | If $g_aEMB_Settings[2] <> Default Then GUISetBkColor($g_aEMB_Settings[2]) 539 | 540 | ; Check if user closure permitted 541 | If BitAND($g_aEMB_Settings[0], 64) Then 542 | $aRet = DllCall("User32.dll", "hwnd", "GetSystemMenu", "hwnd", $hMsgGUI, "int", 0) 543 | Local $hSysMenu = $aRet[0] 544 | DllCall("User32.dll", "int", "RemoveMenu", "hwnd", $hSysMenu, "int", 0xF060, "int", 0) ; $SC_CLOSE 545 | DllCall("User32.dll", "int", "DrawMenuBar", "hwnd", $hMsgGUI) 546 | EndIf 547 | 548 | ; Set centring parameter 549 | Local $iLabel_Style = 0 ; $SS_LEFT 550 | If BitAND($g_aEMB_Settings[1], 1) = 1 Then 551 | $iLabel_Style = 1 ; $SS_CENTER 552 | ElseIf BitAND($g_aEMB_Settings[1], 2) = 2 Then 553 | $iLabel_Style = 2 ; $SS_RIGHT 554 | EndIf 555 | 556 | ; Create label 557 | GUICtrlCreateLabel($sText, 10 + $iIcon_Reduction, $iLabel_Vert, $iLabel_Width, $iLabel_Height, $iLabel_Style) 558 | GUICtrlSetFont(-1, $g_aEMB_Settings[4], Default, Default, $g_aEMB_Settings[5]) 559 | If $g_aEMB_Settings[3] <> Default Then GUICtrlSetColor(-1, $g_aEMB_Settings[3]) 560 | 561 | ; Create checkbox if required 562 | If BitAND($g_aEMB_Settings[0], 16) Then 563 | Local $sAgain = " Do not show again" 564 | Local $iY = $iLabel_Vert + $iLabel_Height + 10 565 | ; Create checkbox 566 | $cCheckbox = GUICtrlCreateCheckbox("", 10 + $iIcon_Reduction, $iY, 20, 20) 567 | ; Write text in separate checkbox label 568 | Local $cCheckLabel = GUICtrlCreateLabel($sAgain, 20, 20, 20, 20) 569 | GUICtrlSetColor($cCheckLabel, $g_aEMB_Settings[3]) 570 | GUICtrlSetBkColor($cCheckLabel, $g_aEMB_Settings[2]) 571 | ; Set font if required and size checkbox label text 572 | If BitAND($g_aEMB_Settings[0], 4) Then 573 | $aLabel_Size = _StringSize($sAgain) 574 | Else 575 | $aLabel_Size = _StringSize($sAgain, $g_aEMB_Settings[4], 400, 0, $g_aEMB_Settings[5]) 576 | GUICtrlSetFont($cCheckLabel, $g_aEMB_Settings[4], 400, 0, $g_aEMB_Settings[5]) 577 | EndIf 578 | ; Move and resize checkbox label to fit 579 | $iY = ($iY + 10) - ($aLabel_Size[3] - 4) / 2 580 | ControlMove($hMsgGUI, "", $cCheckLabel, 30 + $iIcon_Reduction, $iY, $iMsg_Width - (30 + $iIcon_Reduction), $aLabel_Size[3]) 581 | EndIf 582 | 583 | ; Create icon or countdown timer 584 | If $fCountdown = True Then 585 | Local $cCountdown_Label = GUICtrlCreateLabel(StringFormat("%2s", $iTimeOut), 10, 20, 32, 32) 586 | GUICtrlSetFont(-1, 18, Default, Default, $g_aEMB_Settings[5]) 587 | GUICtrlSetColor(-1, $g_aEMB_Settings[3]) 588 | Else 589 | If $iIcon_Reduction Then GUICtrlCreateIcon($sDLL, $iIcon_Style, 10, 20) 590 | EndIf 591 | 592 | ; Create buttons 593 | Local $cAccel_Key = 9999 ; Placeholder to prevent firing if no buttons 594 | If $vButton <> " " Then 595 | 596 | ; Create dummy control for Accel key 597 | $cAccel_Key = GUICtrlCreateDummy() 598 | ; Set Space key as Accel key 599 | Local $aAccel_Key[1][2] = [["{SPACE}", $cAccel_Key]] 600 | GUISetAccelerators($aAccel_Key) 601 | 602 | ; Calculate button horizontal start 603 | If $aButton_Text[0] = 1 Then 604 | If BitAND($g_aEMB_Settings[1], 4) = 4 Then 605 | ; Single centred button 606 | $iButton_Xpos = ($iDialog_Width - $iButton_Width) / 2 607 | Else 608 | ; Single offset button 609 | $iButton_Xpos = $iDialog_Width - $iButton_Width - 10 610 | EndIf 611 | Else 612 | ; Multiple centred buttons 613 | $iButton_Xpos = ($iDialog_Width - ($iButton_Width_Req - 20)) / 2 614 | EndIf 615 | ; Set default button code 616 | Local $iDefButton_Code = 0 617 | ; Set default button style 618 | Local $iDef_Button_Style = 0 619 | ; Work through button list 620 | For $i = 0 To $aButton_Text[0] - 1 621 | Local $iButton_Text = $aButton_Text[$i + 1] 622 | ; Set default button 623 | If $aButton_Text[0] = 1 Then ; Only 1 button 624 | $iDef_Button_Style = 0x0001 625 | ElseIf StringLeft($iButton_Text, 1) = "&" Then ; Look for & 626 | $iDef_Button_Style = 0x0001 627 | $aButton_Text[$i + 1] = StringTrimLeft($iButton_Text, 1) 628 | ; Set default button code for Accel key return 629 | $iDefButton_Code = $i + 1 630 | EndIf 631 | ; Draw button 632 | GUICtrlCreateButton($aButton_Text[$i + 1], $iButton_Xpos + ($i * ($iButton_Width + 10)), $iMsg_Height - 35, $iButton_Width, 25, $iDef_Button_Style) 633 | ; Set font if required 634 | If Not BitAND($g_aEMB_Settings[0], 4) Then GUICtrlSetFont(-1, $g_aEMB_Settings[4], 400, 0, $g_aEMB_Settings[5]) 635 | ; Reset default style parameter 636 | $iDef_Button_Style = 0 637 | Next 638 | EndIf 639 | 640 | ; Show GUI 641 | GUISetState(@SW_SHOW, $hMsgGUI) 642 | 643 | ; Begin timeout counter 644 | Local $iTimeout_Begin = TimerInit() 645 | Local $iCounter = 0 646 | 647 | ; Declare GUIGetMsg return array here and not in loop 648 | Local $aMsg 649 | 650 | ; Set MessageLoop mode 651 | Local $iOrgMode = Opt('GUIOnEventMode', 0) 652 | 653 | While 1 654 | $aMsg = GUIGetMsg(1) 655 | 656 | If $aMsg[1] = $hMsgGUI Then 657 | Select 658 | Case $aMsg[0] = -3 ; $GUI_EVENT_CLOSE 659 | $iRet_Value = 0 660 | ExitLoop 661 | Case $aMsg[0] = $cAccel_Key 662 | ; Accel key pressed so return default button code 663 | If $iDefButton_Code Then 664 | $iRet_Value = $iDefButton_Code 665 | ExitLoop 666 | EndIf 667 | Case $aMsg[0] > $cAccel_Key 668 | ; Button handle minus Accel key handle will give button index 669 | $iRet_Value = $aMsg[0] - $cAccel_Key 670 | ExitLoop 671 | EndSelect 672 | EndIf 673 | 674 | ; Timeout if required 675 | If TimerDiff($iTimeout_Begin) / 1000 >= $iTimeOut And $iTimeOut > 0 Then 676 | $iRet_Value = 9 677 | ExitLoop 678 | EndIf 679 | 680 | ; Show countdown if required 681 | If $fCountdown = True Then 682 | Local $iTimeRun = Int(TimerDiff($iTimeout_Begin) / 1000) 683 | If $iTimeRun <> $iCounter Then 684 | $iCounter = $iTimeRun 685 | GUICtrlSetData($cCountdown_Label, StringFormat("%2s", $iTimeOut - $iCounter)) 686 | EndIf 687 | EndIf 688 | 689 | WEnd 690 | 691 | ; Reset original mode 692 | Opt('GUIOnEventMode', $iOrgMode) 693 | 694 | If GUICtrlRead($cCheckbox) = 1 Then 695 | ; Negate the return value 696 | $iRet_Value *= -1 697 | EndIf 698 | 699 | GUIDelete($hMsgGUI) 700 | 701 | Return $iRet_Value 702 | 703 | EndFunc ;==>_ExtMsgBox 704 | 705 | ; #INTERNAL_USE_ONLY#============================================================================================================ 706 | ; Name...........: _EMB_GetDefaultFont 707 | ; Description ...: Determines Windows default MsgBox font size and name 708 | ; Syntax.........: _EMB_GetDefaultFont() 709 | ; Return values .: Success - Array holding determined font data 710 | ; : Failure - Array holding default values 711 | ; Array elements - [0] = Size, [1] = Weight, [2] = Style, [3] = Name, [4] = Quality 712 | ; Author ........: KaFu 713 | ; Remarks .......: Used internally by ExtMsgBox UDF 714 | ; =============================================================================================================================== 715 | Func __EMB_GetDefaultFont() 716 | 717 | ; Fill array with standard default data 718 | Local $aDefFontData[2] = [9, "Tahoma"] 719 | 720 | ; Get AutoIt GUI handle 721 | Local $hWnd = WinGetHandle(AutoItWinGetTitle()) 722 | ; Open Theme DLL 723 | Local $hThemeDLL = DllOpen("uxtheme.dll") 724 | ; Get default theme handle 725 | Local $hTheme = DllCall($hThemeDLL, 'ptr', 'OpenThemeData', 'hwnd', $hWnd, 'wstr', "Static") 726 | If @error Then Return $aDefFontData 727 | $hTheme = $hTheme[0] 728 | ; Create LOGFONT structure 729 | Local $tFont = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;wchar[32]") 730 | Local $pFont = DllStructGetPtr($tFont) 731 | ; Get MsgBox font from theme 732 | DllCall($hThemeDLL, 'long', 'GetThemeSysFont', 'HANDLE', $hTheme, 'int', 805, 'ptr', $pFont) ; TMT_MSGBOXFONT 733 | If @error Then Return $aDefFontData 734 | ; Get default DC 735 | Local $hDC = DllCall("user32.dll", "handle", "GetDC", "hwnd", $hWnd) 736 | If @error Then Return $aDefFontData 737 | $hDC = $hDC[0] 738 | ; Get font vertical size 739 | Local $iPixel_Y = DllCall("gdi32.dll", "int", "GetDeviceCaps", "handle", $hDC, "int", 90) ; LOGPIXELSY 740 | If Not @error Then 741 | $iPixel_Y = $iPixel_Y[0] 742 | $aDefFontData[0] = Int(2 * (.25 - DllStructGetData($tFont, 1) * 72 / $iPixel_Y)) / 2 743 | EndIf 744 | ; Close DC 745 | DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $hWnd, "handle", $hDC) 746 | ; Extract font data from LOGFONT structure 747 | $aDefFontData[1] = DllStructGetData($tFont, 14) 748 | 749 | Return $aDefFontData 750 | 751 | EndFunc ;==>__EMB_GetDefaultFont 752 | 753 | 754 | -------------------------------------------------------------------------------- /Include/_MultiLang.au3: -------------------------------------------------------------------------------- 1 | ;======================================================= 2 | ; Name: MultiLang.au3 3 | ; Description: A way to create multi-language GUIs 4 | ; IT WILL NOT AUTOMATICALLY TRANSLATE 5 | ; YOUR GUIS, rather it will select 6 | ; the appropriate language for you 7 | ; to load 8 | ; Author: Brett Francis (BrettF) 9 | ; Website: http://www.signa5.com 10 | ; Last Updated: 14 August 2010 11 | ;======================================================= 12 | 13 | ;======================================================= 14 | ; Declare Global Variables 15 | ;======================================================= 16 | ;Global Handles 17 | Global $_gh_aLangFileArray = -1 18 | Global $_gh_sLangFileSelected = -1 19 | Global $_gh_sLangFileData = -1 20 | 21 | ;======================================================= 22 | ; Name: _MultiLang_SetFileInfo($aLangFileArray) 23 | ; Description: Sets the loadable languages for use 24 | ; Author: Brett Francis (BrettF) 25 | ; Parameters: $aLangFileArray 26 | ; Array containg: 27 | ; [n][0] = Display Name in Local 28 | ; Language 29 | ; [n][1] = Language File (Full 30 | ; path. 31 | ; [n][2] = Character codes as 32 | ; used by @OS_LANG 33 | ; [Space delimited] 34 | ; Returns: Success = 1 35 | ; Failure = 0 36 | ; @error Codes: 1 = $aLangFileArray is not an array 37 | ; 2 = $aLangFileArray is malformed 38 | ; Website: http://www.signa5.com 39 | ; Last Updated: 14 August 2010 40 | ;======================================================= 41 | Func _MultiLang_SetFileInfo($aLangFileArray) 42 | If IsArray($aLangFileArray) = 0 Then Return SetError(1, 0, 0) 43 | If UBound($aLangFileArray, 0) <> 2 Then Return SetError(2, 0, 0) 44 | If UBound($aLangFileArray, 2) <> 3 Then Return SetError(2, 0, 0) 45 | $_gh_aLangFileArray = $aLangFileArray 46 | Return 1 47 | EndFunc ;==>_MultiLang_SetFileInfo 48 | 49 | ;======================================================= 50 | ; Name: _MultiLang_LoadLangFile($nLangCode) 51 | ; Description: Sets the loadable languages for use 52 | ; Author: Brett Francis (BrettF) 53 | ; Parameters: $nLangCode 54 | ; Character codes as used by @OS_LANG 55 | ; Returns: Success = 1 File was opened 56 | ; 2 Default language file 57 | ; was opened. Usually 58 | ; caused by incorrect value 59 | ; of $nLangCode 60 | ; Failure = 0 61 | ; @error Codes: 1 = _MultiLang_SetFileInfo has not 62 | ; been called or the array is 63 | ; malformed 64 | ; 2 = Could not open language file 65 | ; Website: http://www.signa5.com 66 | ; Last Updated: 14 August 2010 67 | ;======================================================= 68 | Func _MultiLang_LoadLangFile($nLangCode) 69 | Local $ret = 1 70 | $_gh_sLangFileSelected = -1 71 | If $_gh_aLangFileArray = -1 Then Return SetError(1, 0, 0) 72 | If IsArray($_gh_aLangFileArray) = 0 Then Return SetError(1, 0, 0) 73 | For $i = 0 To UBound($_gh_aLangFileArray) - 1 74 | If StringInStr($_gh_aLangFileArray[$i][2], $nLangCode) Then 75 | $_gh_sLangFileSelected = $_gh_aLangFileArray[$i][1] 76 | ExitLoop 77 | EndIf 78 | Next 79 | If $_gh_sLangFileSelected == -1 Then 80 | $_gh_sLangFileSelected = $_gh_aLangFileArray[0][1] 81 | $ret = 2 ;Lets user know we loaded the default 82 | EndIf 83 | 84 | $_gh_sLangFileData = FileRead($_gh_sLangFileSelected) 85 | If @error Then Return SetError(2, 0, 0) 86 | Return $ret 87 | EndFunc ;==>_MultiLang_LoadLangFile 88 | 89 | ;======================================================= 90 | ; Name: _MultiLang_GetText($sControl, $multiline = 0, $default = @OSLang) 91 | ; Description: Sets the loadable languages for use 92 | ; Author: Brett Francis (BrettF) 93 | ; Parameters: $sControl 94 | ; Tag to read 95 | ; $multiline [Default = 0] 96 | ; = 1 Replace 97 | ; "@CRLF" 98 | ; "@LF" 99 | ; "@CR" 100 | ; With proper characters. 101 | ; $default [Default = "Unknown Text"] 102 | ; What text to return when the 103 | ; value could not be found in the 104 | ; language file 105 | ; Returns: Success = Loaded text 106 | ; Failure = 0 107 | ; @error Codes: 1 = _MultiLang_SetFileInfo has not 108 | ; been called or the array is 109 | ; malformed 110 | ; 2 = _MultiLang_LoadLangFile has not 111 | ; been called 112 | ; 3 = Tag could not be found. 113 | ; Default value loaded. ($default) 114 | ; Website: http://www.signa5.com 115 | ; Last Updated: 14 August 2010 116 | ;======================================================= 117 | Func _MultiLang_GetText($sControl, $multiline = 0, $default = "Unknown Text") 118 | If $_gh_aLangFileArray = -1 Then Return SetError(1, 0, 0) 119 | If IsArray($_gh_aLangFileArray) = 0 Then Return SetError(1, 0, 0) 120 | If $_gh_sLangFileData = -1 Then Return SetError(2, 0, 0) 121 | Local $a_ret = StringRegExp($_gh_sLangFileData, '<(?i)' & $sControl & '>(.*?)', 3) 122 | If Not @error Then 123 | $a_ret = StringStripWS($a_ret[0], 2) 124 | If $multiline = 1 Then 125 | $a_ret = StringReplace($a_ret, "@CRLF", @CRLF) 126 | $a_ret = StringReplace($a_ret, "@LF", @LF) 127 | $a_ret = StringReplace($a_ret, "@CR", @CR) 128 | EndIf 129 | Return $a_ret 130 | EndIf 131 | Return SetError (3, 0, $default) 132 | EndFunc ;==>_MultiLang_GetText 133 | 134 | ;======================================================= 135 | ; Name: _MultiLang_SelectGUI($title, $text, $default = @OSLang) 136 | ; Description: Sets the loadable languages for use 137 | ; Author: Brett Francis (BrettF) 138 | ; Parameters: $title 139 | ; Title of the GUI 140 | ; $text 141 | ; Prompt for user 142 | ; $default = @OSLang 143 | ; Default to load when user does 144 | ; not select a valid value. 145 | ; Returns: Success = Returns Language Code 146 | ; Failure = 0 147 | ; @error Codes: 1 = _MultiLang_SetFileInfo has not 148 | ; been called or the array is 149 | ; malformed 150 | ; Website: http://www.signa5.com 151 | ; Last Updated: 14 August 2010 152 | ;======================================================= 153 | Func _MultiLang_SelectGUI($title, $text, $default = @OSLang) 154 | If $_gh_aLangFileArray = -1 Then Return SetError(1, 0, 0) 155 | If IsArray($_gh_aLangFileArray) = 0 Then Return SetError(1, 0, 0) 156 | $_multilang_gui_GUI = GUICreate($title, 230, 100) 157 | $_multilang_gui_Combo = GUICtrlCreateCombo("(Select A Language)", 8, 48, 209, 25, 0x0003) 158 | $_multilang_gui_Button = GUICtrlCreateButton("Select", 144, 72, 75, 25) 159 | $_multilang_gui_Label = GUICtrlCreateLabel($text, 8, 8, 212, 33) 160 | 161 | ;Create List of available languages 162 | For $i = 0 To UBound($_gh_aLangFileArray) - 1 163 | GUICtrlSetData($_multilang_gui_Combo, $_gh_aLangFileArray[$i][0], "(Select A Language)") 164 | Next 165 | 166 | GUISetState(@SW_SHOW) 167 | While 1 168 | $nMsg = GUIGetMsg() 169 | Switch $nMsg 170 | Case -3, $_multilang_gui_Button 171 | ExitLoop 172 | EndSwitch 173 | WEnd 174 | $_selected = GUICtrlRead ($_multilang_gui_Combo) 175 | GUIDelete ($_multilang_gui_GUI) 176 | For $i = 0 To UBound($_gh_aLangFileArray) - 1 177 | If StringInStr ($_gh_aLangFileArray[$i][0], $_selected) Then 178 | Return StringLeft ($_gh_aLangFileArray[$i][2], 4) 179 | EndIf 180 | Next 181 | Return $default 182 | EndFunc ;==>_MultiLang_SelectGUI 183 | 184 | ;======================================================= 185 | ; Name: _MultiLang_Close() 186 | ; Description: Resets all opened variables. 187 | ; Author: Brett Francis (BrettF) 188 | ; Parameters: None 189 | ; Returns: Nothing 190 | ; @error Codes: None 191 | ; Website: http://www.signa5.com 192 | ; Last Updated: 14 August 2010 193 | ;======================================================= 194 | Func _MultiLang_Close() 195 | $_gh_aLangFileArray = -1 196 | $_gh_sLangFileSelected = -1 197 | $_gh_sLangFileData = -1 198 | EndFunc ;==>_MultiLang_Close -------------------------------------------------------------------------------- /Include/_Trim.au3: -------------------------------------------------------------------------------- 1 | ; =========================== 2 | ; MyFunctions.au3 for AutoIt3 3 | ; =========================== 4 | ; Author: Brett Sinclair 5 | ; email: autoitdev@pgsd.co.nz 6 | ; 31 July 2005 7 | ; 8 | ; Purpose: Implements new functions _RTRIM(), _LTRIM(), _ALLTRIM() 9 | ; 10 | ; To implement functions equivalent to the old dBase functions that removed spaces 11 | ; from the, respectively, right, left and both left and right of a character string. 12 | ; The function _TRIM() is equivalent to _RTRIM() and is provided for consistency with 13 | ; the old dBase standard. 14 | ; 15 | ; These four functions remove contiguous characters from the left and/or right of a character string 16 | ; but not those that are within the string. For example _RTRIM("Mary had a little lamb ") 17 | ; will become "Mary had a little lamb" - the spaces inside the string are not removed. 18 | ; 19 | ; Syntax: ResultString = ( string1, string2 ) 20 | ; 21 | ; as above: _RTRIM(), _LTRIM(), _ALLTRIM(), _TRIM() 22 | ; string1 is the character string to examine. 23 | ; string2 is a list of the characters to be examined for; if omitted it defaults to the standard space character, chr(32). 24 | ; ResultString is the string returned by the function with all characters in string2 trimmed from the left and/or right 25 | ; of string1. 26 | ; 27 | ; If string2 = "%%whs%%" all white space characters will be trimmed from string1. 28 | ; Whitespace includes Chr(9) thru Chr(13) which are HorizontalTab, LineFeed, VerticalTab, FormFeed, and CarriageReturn. 29 | ; Whitespace also includes the standard space character. 30 | ; 31 | ; ResultString will be shorter than string1 by an amount equal to the number of characters trimmed from string1. 32 | ; 33 | ; These functions are not case sensitive, e.g. "m" in string2 will trim both "M" and "m" from string1. 34 | ; 35 | ; On any error condition ResultString will be equal to string1. 36 | ; 37 | ; Examples: _RTRIM("Mary had a little lamb ") -> "Mary had a little lamb" 38 | ; _RTRIM("Mary had a little giraffe xyxyxyz", "xyz") -> "Mary had a little giraffe " (note space at end has not been removed). 39 | ; _RTRIM("Mary had a little giraffe xyxyxyz", " xyz") -> "Mary had a little giraffe" (now the same space has been removed because 40 | ; a space is now included in string2). 41 | ; _RTRIM("Mary had a little giraffe xyxbyxyz", "xyz") -> "Mary had a little giraffe xyxb" (only the x, y and z following the "b" 42 | ; will be removed because the "b" is not in string2. 43 | ; 44 | ; To use: 1. Copy this script to the "Include" folder under the AutoIt programs folder. 45 | ; (for example: c:\program files\autoit3\include\myfunctions.au3 ) 46 | ; 2. In your Autoit3 script have following statement: 47 | ; #include 48 | ; 3. "myfunctions" can be renamed to anything you want. 49 | ; 50 | ; Disclaimer: Thoroughly tested and debugged, but use entirely at your own risk. 51 | ; Usage automatically acknowledges acceptance of this condition. 52 | ; ============================================================================================== 53 | ; 54 | func _LTRIM($sString, $sTrimChars=' ') 55 | 56 | $sTrimChars = StringReplace( $sTrimChars, "%%whs%%", " " & chr(9) & chr(11) & chr(12) & @CRLF ) 57 | local $nCount, $nFoundChar 58 | local $aStringArray = StringSplit($sString, "") 59 | local $aCharsArray = StringSplit($sTrimChars, "") 60 | 61 | for $nCount = 1 to $aStringArray[0] 62 | $nFoundChar = 0 63 | for $i = 1 to $aCharsArray[0] 64 | if $aCharsArray[$i] = $aStringArray[$nCount] then 65 | $nFoundChar = 1 66 | EndIf 67 | next 68 | if $nFoundChar = 0 then return StringTrimLeft( $sString, ($nCount-1) ) 69 | next 70 | endfunc 71 | ; ============================================================================================== 72 | ; 73 | func _RTRIM($sString, $sTrimChars=' ') 74 | 75 | $sTrimChars = StringReplace( $sTrimChars, "%%whs%%", " " & chr(9) & chr(11) & chr(12) & @CRLF ) 76 | local $nCount, $nFoundChar 77 | local $aStringArray = StringSplit($sString, "") 78 | local $aCharsArray = StringSplit($sTrimChars, "") 79 | 80 | for $nCount = $aStringArray[0] to 1 step -1 81 | $nFoundChar = 0 82 | for $i = 1 to $aCharsArray[0] 83 | if $aCharsArray[$i] = $aStringArray[$nCount] then 84 | $nFoundChar = 1 85 | EndIf 86 | next 87 | if $nFoundChar = 0 then return StringTrimRight( $sString, ($aStringArray[0] - $nCount) ) 88 | next 89 | endfunc 90 | ; ============================================================================================== 91 | ; 92 | func _ALLTRIM($sString, $sTrimChars=' ') 93 | 94 | ; Trim from left first, then right 95 | 96 | $sTrimChars = StringReplace( $sTrimChars, "%%whs%%", " " & chr(9) & chr(11) & chr(12) & @CRLF ) 97 | local $sStringWork = "" 98 | 99 | $sStringWork = _LTRIM($sString, $sTrimChars) 100 | if $sStringWork <> "" then 101 | $sStringWork = _RTRIM($sStringWork, $sTrimChars) 102 | endif 103 | return $sStringWork 104 | 105 | endfunc 106 | ; ============================================================================================== 107 | ; 108 | func _TRIM($sString, $sTrimChars=' ') ; Equivalent to _RTRIM() and provided for dBase equivalence. 109 | 110 | return _RTRIM( $sString, $sTrimChars ) 111 | 112 | endfunc 113 | ; ============================================================================================== -------------------------------------------------------------------------------- /LanguageFiles/URC-ENGLISH.XML: -------------------------------------------------------------------------------- 1 | 2 | Universal ROM Cleaner 3 | 4 | File 5 | languages 6 | Load roms 7 | Exit 8 | Actions 9 | Simulation 10 | Cleaning 11 | Help 12 | About 13 | 14 | 15 | Sort Attributes 16 | Rejected attributes 17 | Ignored attributes 18 | 19 | Select a language 20 | Please select a language 21 | Select 22 | 23 | 24 | Select roms directory 25 | 26 | 27 | About 28 | Created by : Screech 29 | Thanks to : 30 | 31 | 32 | 33 | Cleaning Roms 34 | Making temp table : 35 | Moving roms : 36 | Checking roms to keep : 37 | Filling simulation file : 38 | Loading attributes 39 | Loading attributes : 40 | Loading roms 41 | Loading roms : 42 | Sorting roms 43 | Sorting roms : 44 | Canceling roms 45 | Canceling roms : 46 | 47 | 48 | -------------------------------------------------------------------------------- /LanguageFiles/URC-FRENCH.XML: -------------------------------------------------------------------------------- 1 | 2 | Universal ROM Cleaner 3 | 4 | Fichier 5 | Langues 6 | Charger les roms 7 | Quitter 8 | Actions 9 | Simulation 10 | Nettoyage 11 | Aide 12 | A propos 13 | 14 | 15 | Classez les attributs dans l'ordre 16 | Attributs non conservés 17 | Attributs ignorés 18 | 19 | Sélectionner une langue 20 | Merci de sélectionner une langue 21 | Sélectionner 22 | 23 | 24 | Sélectionnez le repertoire des roms 25 | 26 | 27 | A propos 28 | Auteur : Screech 29 | Remerciement à : 30 | 31 | 32 | 33 | Nettoyage des Roms 34 | Nettoyage de la table Temporaire : 35 | Création du dictionnaire : 36 | Déplacement des roms : 37 | Vérification des roms à garder : 38 | Remplissage du fichier de simulation : 39 | Récupération des attributs 40 | Récupération des attributs : 41 | Récupération des roms 42 | Récupération des roms : 43 | Tri des roms 44 | Tri des roms : 45 | Retrait des roms 46 | Retrait des roms non conservées : 47 | 48 | 49 | -------------------------------------------------------------------------------- /LanguageFiles/URC-GERMAN.XML: -------------------------------------------------------------------------------- 1 | 2 | Universal ROM Cleaner 3 | 4 | Datei 5 | Sprachen 6 | Lade ROMS 7 | Beenden 8 | Aktionen 9 | Simulation 10 | Bereinigen 11 | Hilfe 12 | Über 13 | 14 | 15 | Auswahl Attribute 16 | Abgelehnte Attribute 17 | Ignorierte Attribute 18 | 19 | Sprache wählen 20 | Bitte wähle eine Sprache 21 | Auswählen 22 | 23 | 24 | Wähle ROM Verzeichnis 25 | 26 | 27 | Über 28 | Erstellt von: Screech 29 | Dank an: 30 | 31 | 32 | 33 | Bereinige ROMS 34 | Erstelle temporäre Tabelle: 35 | Verschiebe ROMS: 36 | Prüfe zu behaltene ROMS: 37 | Fülle die Simulationsdatei: 38 | Lade Attribute 39 | Attribute werden geladen: 40 | Lade ROMS 41 | ROMS werden geladen: 42 | Sortiere ROMS 43 | ROMS werden sortiert: 44 | Schliesse ROMS aus 45 | ROMS werden ausgeschlossen: 46 | 47 | 48 | -------------------------------------------------------------------------------- /LanguageFiles/URC-SPANISH.XML: -------------------------------------------------------------------------------- 1 | 2 | Universal ROM Cleaner 3 | 4 | Archivo 5 | idiomas 6 | Cargar roms 7 | Salir 8 | Acciones 9 | Simulación 10 | Limpiando 11 | Ayuda 12 | Acerca de 13 | 14 | 15 | Ordenar atributos 16 | Atributos rechazados 17 | Atributos ignorados 18 | 19 | Seleccionar un idioma 20 | Por favor selecciona un idioma 21 | Seleccionar 22 | 23 | 24 | Seleccionar directorio de roms 25 | 26 | 27 | Acerca de 28 | Creado por: Screech 29 | Gracias a: 30 | 31 | 32 | 33 | Limpiando roms 34 | Creando tabla temporal: 35 | Moviendo roms: 36 | Revisando roms a mantener: 37 | Llenando archivo de simulación: 38 | Cargando atributos 39 | Cargando atributos: 40 | Cargando roms 41 | Cargando roms: 42 | Ordenando roms 43 | Ordenando roms: 44 | Cancelando roms 45 | Cancelando roms: 46 | 47 | 48 | -------------------------------------------------------------------------------- /MakeFakeFile.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Universal-Rom-Tools/Universal-ROM-Cleaner/8733203b9b150d66ccdc7e87f20cad1c18257fc6/MakeFakeFile.exe -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Universal ROM Cleaner 2 | 3 | Ce logiciel vous permet de nettoyer vos romsets facilement en se basant sur les attributs entre parenthèses et entre crochets de vos fichiers. 4 | 5 | - Il est multilingue (Anglais/Français) 6 | - Il se veut simple d’utilisation (tout fonctionne à la souris par de simple glissez déplacez) 7 | 8 | __Comment ça marche :__ 9 | 10 | 1 - Telechargez la derniere version : [Universal Rom Cleaner](https://github.com/Universal-Rom-Tools/Universal-ROM-Cleaner/releases) 11 | 2 - Décompressez l’archive et lancez le fichier EXE. 12 | 3 - Dans le menu Fichier/Chargez les roms, choisissez le répertoire de votre set à nettoyer. 13 | 4 - Dans le tableau de gauche, ordonnées vos préférences (ce que vous souhaitez garder le plus en haut, le moins en base) 14 | 5 - Déplacez dans le tableau en haut a droite ce que vous ne souhaitez pas conserver 15 | 6 - Déplacez dans le tableau en bas à droite ce qui ne doit pas être pris en compte dans le tris 16 | 7 - Dans le menu action vous pouvez soit simuler le tri (vous aurez alors un fichier texte avec OK ce qui est gardé, KO ce qui n’est pas gardé) ou directement faire le nettoyage 17 | 8 - C’est finit, vous avez un beau romset tout propre pour votre recalbox) 18 | 19 | __Informations supplémentaire :__ 20 | Le soft ne supprime rien, il ne fait que déplacer dans un répertoire “ROM_CLEAN” les roms sélectionnées et triées 21 | 22 | ![Universal ROM Cleaner Interface](http://zupimages.net/up/16/10/xd29.jpg "Interface") 23 | 24 | Dans l’exemple de la copie d’écran voici ce qu’il fait si vous avez : 25 | 26 | - mario (USA) (En,Fr,De).zip 27 | - mario (Europe) (En,Fr,De).zip 28 | - mario (Europe) (En,Fr,De,Es).zip 29 | - mario (Europe) (En,Fr,De) (Beta).zip 30 | - mario (Japan).zip 31 | Le seul fichier gardé sera “mario (Europe) (En,Fr,De).zip” 32 | 33 | Parce que : je lui demande de ne pas garder les “Beta” ou les “Japan” et que dans l’ordre, je garde les fichier “Europe” avant les fichier “USA” et que après ce premier choix, je garde en priorité ceux en “En,Fr,De” avant ceux en “En,Fr,De,Es” 34 | 35 | N'hesitez pas à faire des simulation si vous n’êtes pas sur de votre choix 😉 36 | 37 | __UDF utilisé__ 38 | [GUIListViewEx](https://www.autoitscript.com/forum/topic/124980-guilistviewex-new-version-7-mar-16/) par Melba23 39 | [Extended Message Box](https://www.autoitscript.com/forum/topic/109096-extended-message-box-bugfix-version-9-aug-15/) par Melba23 40 | [ArrayMultiColSort](https://www.autoitscript.com/forum/topic/155442-arraymulticolsort-new-release-15-sep-15/) par Melba23 41 | [MultiLang](https://www.autoitscript.com/forum/topic/118495-multilangau3/) par BrettF 42 | [Trim](https://www.autoitscript.com/forum/topic/14173-new-string-trim-functions/) par blitzer99 43 | -------------------------------------------------------------------------------- /Ressources/Universal_Rom_Cleaner.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Universal-Rom-Tools/Universal-ROM-Cleaner/8733203b9b150d66ccdc7e87f20cad1c18257fc6/Ressources/Universal_Rom_Cleaner.ico -------------------------------------------------------------------------------- /URC-config.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Universal-Rom-Tools/Universal-ROM-Cleaner/8733203b9b150d66ccdc7e87f20cad1c18257fc6/URC-config.ini -------------------------------------------------------------------------------- /Universal ROM Cleaner.au3: -------------------------------------------------------------------------------- 1 | #Region ;**** Directives created by AutoIt3Wrapper_GUI **** 2 | #AutoIt3Wrapper_Icon=Ressources\Universal_Rom_Cleaner.ico 3 | #AutoIt3Wrapper_Outfile=..\BIN\Universal_Rom_Cleaner.exe 4 | #AutoIt3Wrapper_Outfile_x64=..\BIN\Universal_Rom_Cleaner64.exe 5 | #AutoIt3Wrapper_Compile_Both=y 6 | #AutoIt3Wrapper_UseX64=y 7 | #AutoIt3Wrapper_Res_Description=Nettoyeur de Rom Universel 8 | #AutoIt3Wrapper_Res_Fileversion=2.0.0.3 9 | #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p 10 | #AutoIt3Wrapper_Res_LegalCopyright=LEGRAS David 11 | #AutoIt3Wrapper_Res_Language=1036 12 | #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y 13 | #AutoIt3Wrapper_Run_Tidy=y 14 | #AutoIt3Wrapper_UseUpx=n 15 | #Tidy_Parameters=/reel 16 | #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** 17 | 18 | ;************************************************************************* 19 | ;** ** 20 | ;** Universal Rom Cleaner ** 21 | ;** LEGRAS David ** 22 | ;** ** 23 | ;************************************************************************* 24 | 25 | ;Definition des librairies 26 | ;------------------------- 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "./Include/_MultiLang.au3" 39 | #include "./Include/_GUIListViewEx.au3" 40 | #include "./Include/_ExtMsgBox.au3" 41 | #include "./Include/_Trim.au3" 42 | #include "./Include/_ArrayMultiColSort.au3" 43 | 44 | ;FileInstall 45 | ;----------- 46 | Global $SOURCE_DIRECTORY = @ScriptDir 47 | If Not _FileCreate($SOURCE_DIRECTORY & "\test") Then ;Verification des droits en ecriture 48 | $SOURCE_DIRECTORY = @AppDataDir & "\Universal_ROM_Tools" 49 | DirCreate($SOURCE_DIRECTORY) 50 | Else 51 | FileDelete($SOURCE_DIRECTORY & "\test") 52 | EndIf 53 | 54 | Global $Rev 55 | Global $PathConfigINI = $SOURCE_DIRECTORY & "\URC-config.ini" 56 | If @Compiled Then 57 | $Rev = FileGetVersion(@ScriptFullPath) 58 | Local $verINI = IniRead($PathConfigINI, "GENERAL", "$verINI", '0.0.0.0') 59 | $Softname = "UniversalXMLScraperV" & $Rev 60 | If $verINI <> $Rev Then 61 | FileDelete($SOURCE_DIRECTORY & "\URC-config.ini") 62 | FileDelete($SOURCE_DIRECTORY & "\LanguageFiles") 63 | FileDelete($SOURCE_DIRECTORY & "\Ressources") 64 | ConsoleWrite("Ini Deleted" & @CRLF) ;Debug 65 | EndIf 66 | Else 67 | $Rev = 'In Progress' 68 | EndIf 69 | 70 | DirCreate($SOURCE_DIRECTORY & "\LanguageFiles") 71 | DirCreate($SOURCE_DIRECTORY & "\Ressources") 72 | FileInstall(".\URC-config.ini", $SOURCE_DIRECTORY & "\URC-config.ini") 73 | FileInstall(".\LanguageFiles\URC-ENGLISH.XML", $SOURCE_DIRECTORY & "\LanguageFiles\URC-ENGLISH.XML") 74 | FileInstall(".\LanguageFiles\URC-FRENCH.XML", $SOURCE_DIRECTORY & "\LanguageFiles\URC-FRENCH.XML") 75 | FileInstall(".\LanguageFiles\URC-GERMAN.XML", $SOURCE_DIRECTORY & "\LanguageFiles\URC-GERMAN.XML") 76 | FileInstall(".\LanguageFiles\URC-SPANISH.XML", $SOURCE_DIRECTORY & "\LanguageFiles\URC-SPANISH.XML") 77 | FileInstall(".\Ressources\Universal_Rom_Cleaner.ico", $SOURCE_DIRECTORY & "\Ressources\Universal_Rom_Cleaner.ico") 78 | 79 | ;Definition des Variables 80 | ;------------------------- 81 | 82 | Global $LANG_DIR = $SOURCE_DIRECTORY & "\LanguageFiles" ; Where we are storing the language files. 83 | Global $user_lang = IniRead($PathConfigINI, "LAST_USE", "$user_lang", "default") 84 | Global $path_LOG = IniRead($PathConfigINI, "GENERAL", "Path_LOG", $SOURCE_DIRECTORY & "\log.txt") 85 | Global $path_SIMUL = IniRead($PathConfigINI, "GENERAL", "path_SIMUL", $SOURCE_DIRECTORY & "\simulation.txt") 86 | ;~ Global $Debug = IniRead($PathConfigINI, "GENERAL", "Debug", "0") 87 | Local $V_ROMPath, $I_LV_ATTRIBUTE, $I_LV_SUPPRESS, $I_LV_IGNORE, $A_ROMList, $A_ROMAttribut 88 | 89 | ;---------; 90 | ;Principal; 91 | ;---------; 92 | 93 | _LANG_LOAD($LANG_DIR, $user_lang) ;Chargement de la langue par defaut 94 | 95 | #Region ### START Koda GUI section ### Form= ;Creation de l'interface 96 | $F_UniversalCleaner = GUICreate(_MultiLang_GetText("main_gui") & " - " & $Rev, 528, 367, 192, 124, $WS_SYSMENU + $WS_MAXIMIZEBOX) 97 | GUISetBkColor(0x34495C) 98 | $H_MF = GUICtrlCreateMenu(_MultiLang_GetText("mnu_file")) 99 | $H_MF_ROM = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_file_roms"), $H_MF) 100 | $H_MF_LANGUE = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_file_langue"), $H_MF) 101 | $H_MF_Separation = GUICtrlCreateMenuItem("", $H_MF) 102 | $H_MF_Exit = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_file_exit"), $H_MF) 103 | $H_MA = GUICtrlCreateMenu(_MultiLang_GetText("mnu_action")) 104 | $H_MA_SIMULATION = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_action_simulation"), $H_MA) 105 | $H_MA_CLEAN = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_action_clean"), $H_MA) 106 | $H_MH = GUICtrlCreateMenu(_MultiLang_GetText("mnu_help")) 107 | $H_MH_About = GUICtrlCreateMenuItem(_MultiLang_GetText("mnu_help_about"), $H_MH) 108 | $H_LV_ATTRIBUTE = GUICtrlCreateListView(_MultiLang_GetText("lv_attribute"), 8, 8, 250, 302, $LVS_SHOWSELALWAYS) 109 | _GUICtrlListView_SetExtendedListViewStyle($H_LV_ATTRIBUTE, $LVS_EX_FULLROWSELECT) 110 | _GUICtrlListView_SetColumnWidth($H_LV_ATTRIBUTE, 0, 225) 111 | $H_LV_SUPPRESS = GUICtrlCreateListView(_MultiLang_GetText("lv_suppress"), 264, 8, 250, 150, $LVS_SHOWSELALWAYS) 112 | _GUICtrlListView_SetExtendedListViewStyle($H_LV_SUPPRESS, $LVS_EX_FULLROWSELECT) 113 | _GUICtrlListView_SetColumnWidth($H_LV_SUPPRESS, 0, 225) 114 | $H_LV_IGNORE = GUICtrlCreateListView(_MultiLang_GetText("lv_ignore"), 264, 160, 250, 150, $LVS_SHOWSELALWAYS) 115 | _GUICtrlListView_SetExtendedListViewStyle($H_LV_IGNORE, $LVS_EX_FULLROWSELECT) 116 | _GUICtrlListView_SetColumnWidth($H_LV_IGNORE, 0, 225) 117 | GUISetState(@SW_SHOW) 118 | #EndRegion ### END Koda GUI section ### 119 | 120 | While 1 ; Gestion de l'interface 121 | $nMsg = GUIGetMsg() 122 | Switch $nMsg 123 | Case $H_MF_ROM ;Menu Fichier/Charger le repertoire des ROMs 124 | _GUIListViewEx_Close(0) 125 | _GUICtrlListView_DeleteAllItems($H_LV_ATTRIBUTE) 126 | _GUICtrlListView_DeleteAllItems($H_LV_SUPPRESS) 127 | _GUICtrlListView_DeleteAllItems($H_LV_IGNORE) 128 | $V_ROMPath = FileSelectFolder(_MultiLang_GetText("win_sel_rom_Title"), "", $FSF_CREATEBUTTON, "C:\") 129 | If StringRight($V_ROMPath, 1) <> '\' Then $V_ROMPath = $V_ROMPath & '\' 130 | $A_ROMList = _CREATEARRAY_ROM($V_ROMPath) 131 | $A_ROMAttribut = _CREATEARRAY_ATTRIBUT($A_ROMList) 132 | ;~ If $Debug = 1 Then $A_ROMAttribut = _IMPORTATTRIB($V_ROMPath) 133 | For $B_ROMAttribut = 0 To UBound($A_ROMAttribut) - 1 134 | _GUICtrlListView_AddItem($H_LV_ATTRIBUTE, $A_ROMAttribut[$B_ROMAttribut]) 135 | Next 136 | $I_LV_ATTRIBUTE = _GUIListViewEx_Init($H_LV_ATTRIBUTE, $A_ROMAttribut, 0, 0, True) 137 | $I_LV_SUPPRESS = _GUIListViewEx_Init($H_LV_SUPPRESS, "", 0, 0, True) 138 | $I_LV_IGNORE = _GUIListViewEx_Init($H_LV_IGNORE, "", 0, 0, True) 139 | _GUIListViewEx_MsgRegister() ;Register pour le drag&drop 140 | _GUIListViewEx_SetActive(1) ;Activation de la LV de gauche 141 | Case $H_MF_LANGUE ;Menu Fichier/Langues 142 | _LANG_LOAD($LANG_DIR, -1) 143 | _GUI_REFRESH() 144 | Case $GUI_EVENT_CLOSE, $H_MF_Exit ;Quitter 145 | Exit 146 | Case $H_MA_SIMULATION ;Menu Action/Simulation 147 | ;~ If $Debug = 1 Then _EXPORTATTRIB($V_ROMPath) 148 | $A_ROMList = _MOVE_ROM($V_ROMPath, $I_LV_ATTRIBUTE, $A_ROMList) 149 | $A_ROMList = _SUPPR_ROM($V_ROMPath, $I_LV_SUPPRESS, $A_ROMList) 150 | _CLEAN_ROM($V_ROMPath, $A_ROMList, 0) 151 | Case $H_MA_CLEAN ;Menu Action/Nettoyage 152 | $A_ROMList = _MOVE_ROM($V_ROMPath, $I_LV_ATTRIBUTE, $A_ROMList) 153 | $A_ROMList = _SUPPR_ROM($V_ROMPath, $I_LV_SUPPRESS, $A_ROMList) 154 | _CLEAN_ROM($V_ROMPath, $A_ROMList, 1) 155 | Case $H_MH_About ;Menu Aide/A propos 156 | $sMsg = "UNIVERSAL ROM CLEANER - " & $Rev & @CRLF 157 | $sMsg &= _MultiLang_GetText("win_About_By") & @CRLF & @CRLF 158 | $sMsg &= _MultiLang_GetText("win_About_Thanks") & @CRLF 159 | $sMsg &= "http://www.screenzone.fr/" & @CRLF 160 | $sMsg &= "http://www.screenscraper.fr/" & @CRLF 161 | $sMsg &= "http://www.recalbox.com/" & @CRLF 162 | $sMsg &= "http://www.emulationstation.org/" & @CRLF 163 | _ExtMsgBoxSet(1, 2, 0x34495c, 0xFFFF00, 10, "Arial") 164 | _ExtMsgBox($EMB_ICONINFO, "OK", _MultiLang_GetText("win_About_Title"), $sMsg, 15) 165 | EndSwitch 166 | WEnd 167 | 168 | ;---------; 169 | ;Fonctions; 170 | ;---------; 171 | 172 | Func _GUI_REFRESH() ;Rafraichissement de l'interface 173 | GUICtrlSetData($H_MF, _MultiLang_GetText("mnu_file")) 174 | GUICtrlSetData($H_MF_ROM, _MultiLang_GetText("mnu_file_roms")) 175 | GUICtrlSetData($H_MF_LANGUE, _MultiLang_GetText("mnu_file_langue")) 176 | GUICtrlSetData($H_MF_Exit, _MultiLang_GetText("mnu_file_exit")) 177 | GUICtrlSetData($H_MA, _MultiLang_GetText("mnu_action")) 178 | GUICtrlSetData($H_MA_SIMULATION, _MultiLang_GetText("mnu_action_simulation")) 179 | GUICtrlSetData($H_MA_CLEAN, _MultiLang_GetText("mnu_action_clean")) 180 | GUICtrlSetData($H_MH, _MultiLang_GetText("mnu_help")) 181 | GUICtrlSetData($H_MH_About, _MultiLang_GetText("mnu_help_about")) 182 | GUICtrlSetData($H_LV_ATTRIBUTE, _MultiLang_GetText("lv_attribute")) 183 | GUICtrlSetData($H_LV_SUPPRESS, _MultiLang_GetText("lv_suppress")) 184 | GUICtrlSetData($H_LV_IGNORE, _MultiLang_GetText("lv_ignore")) 185 | EndFunc ;==>_GUI_REFRESH 186 | 187 | Func _CREATEARRAY_ROM($V_ROMPath) ;Creation de la liste des ROMs (Chemin des ROMs) 188 | ;~ Local $A_ROMList = _FileListToArray($V_ROMPath, "*.*z*") 189 | $RechFiles = IniRead($PathConfigINI, "GENERAL", "$RechFiles ", "*.*z*") 190 | Local $A_ROMList = _FileListToArrayRec($V_ROMPath, $RechFiles, $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_SORT) 191 | ProgressOn(_MultiLang_GetText("prbr_createarray_rom_title"), "", "0%") 192 | If @error = 1 Then 193 | MsgBox($MB_SYSTEMMODAL, "", $V_ROMPath & " - Path was invalid.") 194 | Exit 195 | EndIf 196 | If @error = 4 Then 197 | MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") 198 | Exit 199 | EndIf 200 | For $B_COLINSRT = 1 To 3 201 | _ArrayColInsert($A_ROMList, $B_COLINSRT) 202 | Next 203 | For $B_ROMList = 0 To UBound($A_ROMList) - 1 204 | $V_ProgressPRC = Round(($B_ROMList * 100) / (UBound($A_ROMList) - 1)) 205 | ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_createarray_rom_progress") & $V_ProgressPRC & "%") 206 | $A_ROMList[$B_ROMList][3] = $A_ROMList[$B_ROMList][0] 207 | $A_ROMList[$B_ROMList][0] = StringReplace($A_ROMList[$B_ROMList][0], '[', '(') 208 | $A_ROMList[$B_ROMList][0] = StringReplace($A_ROMList[$B_ROMList][0], ']', ')') 209 | $TMP_Path = StringSplit($A_ROMList[$B_ROMList][0], "(") 210 | If $TMP_Path[1] = "" Then 211 | $TMP_Path = StringSplit($A_ROMList[$B_ROMList][0], ")") 212 | $TMP_Path = StringSplit($TMP_Path[2], "(") 213 | EndIf 214 | $A_ROMList[$B_ROMList][1] = _ALLTRIM($TMP_Path[1]) 215 | Next 216 | ;~ _ArrayDisplay($A_ROMList, '$A_ROMList Full') ; Debug 217 | _ArrayDelete($A_ROMList, "0") 218 | _ArraySort($A_ROMList) 219 | ;~ _ArrayDisplay($A_ROMList, '$A_ROMList Clean & Sorted') ; Debug 220 | ProgressOff() 221 | Return $A_ROMList 222 | EndFunc ;==>_CREATEARRAY_ROM 223 | 224 | Func _CREATEARRAY_ATTRIBUT($A_ROMList) ;Creation de la liste des Attributs (Array des ROMs) 225 | Local $A_ROMAttribut[1] 226 | ProgressOn(_MultiLang_GetText("prbr_createarray_attribut_title"), "", "0%") 227 | For $B_ROMList = 0 To UBound($A_ROMList) - 1 228 | $V_ProgressPRC = Round(($B_ROMList * 100) / (UBound($A_ROMList) - 1)) 229 | ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_createarray_attribut_progress") & $V_ProgressPRC & "%") 230 | _ArrayAdd($A_ROMAttribut, _ArrayToString(_StringBetween($A_ROMList[$B_ROMList][0], "(", ")"))) 231 | Next 232 | ;~ _ArrayDisplay($A_ROMAttribut, '$A_ROMAttribut Full') ; Debug 233 | $A_ROMAttribut = _ArrayUnique($A_ROMAttribut) 234 | ;~ _ArrayDisplay($A_ROMAttribut, '$A_ROMAttribut Unique') ; Debug 235 | _ArrayDelete($A_ROMAttribut, "0;1") 236 | _ArraySort($A_ROMAttribut, 1) 237 | ;~ _ArrayDisplay($A_ROMAttribut, '$A_ROMAttribut Clean & Sorted') ; Debug 238 | ProgressOff() 239 | Return $A_ROMAttribut 240 | EndFunc ;==>_CREATEARRAY_ATTRIBUT 241 | 242 | Func _MOVE_ROM($V_ROMPath, $I_LV_ATTRIBUTE, $A_ROMList) ;Definition des ROMs a deplacer (Chemin des ROMs, Indexe de la LV des attributs tries, Array des ROMs) 243 | Local $A_TEMP_RomList 244 | Global $aSortData[][] = [ _ 245 | [1, 0], _ 246 | [2, 1]] 247 | ProgressOn(_MultiLang_GetText("prbr_move_rom_title"), "", "0%") 248 | $A_LV_ATTRIBUTE = _GUIListViewEx_ReturnArray($I_LV_ATTRIBUTE) 249 | ;~ _ArrayReverse($A_LV_ATTRIBUTE) 250 | ;~ For $B_ROMList = 0 To UBound($A_ROMList) - 1 251 | ;~ $A_ROMList[$B_ROMList][2] = 999 252 | ;~ Next 253 | 254 | ;~ _ArrayDisplay($A_ROMList, '$A_ROMList Reversed & Completed') ; Debug 255 | 256 | ;~ For $B_ROMList = 0 To UBound($A_ROMList) - 1 257 | ;~ $V_ProgressPRC = Round(($B_ROMList * 100) / (UBound($A_ROMList) - 1)) 258 | ;~ ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_move_rom_progress") & $V_ProgressPRC & "%") 259 | ;~ For $B_LV_ATTRIBUTE = 0 To UBound($A_LV_ATTRIBUTE) - 1 260 | ;~ If StringInStr($A_ROMList[$B_ROMList][0], "(" & $A_LV_ATTRIBUTE[$B_LV_ATTRIBUTE] & ")") > 0 Then 261 | ;~ If $A_ROMList[$B_ROMList][2] = 1 Then 262 | ;~ $A_ROMList[$B_ROMList][2] = $A_ROMList[$B_ROMList][2] + (($B_LV_ATTRIBUTE + 1) * 100000) 263 | ;~ Else 264 | ;~ $A_ROMList[$B_ROMList][2] = $A_ROMList[$B_ROMList][2] - (10000 - (Round((($B_LV_ATTRIBUTE + 1) * 10000) / (UBound($A_LV_ATTRIBUTE))))) 265 | ;~ EndIf 266 | ;~ EndIf 267 | ;~ Next 268 | ;~ If $A_ROMList[$B_ROMList][2] = 1 Then $A_ROMList[$B_ROMList][2] = 'MAX' 269 | ;~ Next 270 | 271 | For $B_LV_ATTRIBUTE = 0 To UBound($A_LV_ATTRIBUTE) - 1 272 | $V_ProgressPRC = Round(($B_LV_ATTRIBUTE * 100) / (UBound($A_LV_ATTRIBUTE) - 1)) 273 | ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_move_rom_progress") & $V_ProgressPRC & "%") 274 | For $B_ROMList = 0 To UBound($A_ROMList) - 1 275 | If StringInStr($A_ROMList[$B_ROMList][0], "(" & $A_LV_ATTRIBUTE[$B_LV_ATTRIBUTE] & ")") > 0 Then 276 | $A_ROMList[$B_ROMList][2] = $A_ROMList[$B_ROMList][2] & (999 - ($B_LV_ATTRIBUTE + 1)) 277 | Else 278 | $A_ROMList[$B_ROMList][2] = $A_ROMList[$B_ROMList][2] & 999 279 | EndIf 280 | Next 281 | Next 282 | 283 | ;~ _ArrayDisplay($A_ROMList, '$A_ROMList Completed') ; Debug 284 | _ArrayMultiColSort($A_ROMList, $aSortData) 285 | ;~ _ArraySort($A_ROMList, 0, 0, 0, 3) 286 | ;~ _ArrayDisplay($A_ROMList, '$A_ROMList Sorted') ; Debug 287 | ProgressOff() 288 | Return $A_ROMList 289 | EndFunc ;==>_MOVE_ROM 290 | 291 | Func _SUPPR_ROM($V_ROMPath, $I_LV_SUPPRESS, $A_ROMList) ;Definition des ROMs a ne pas garder (Chemin des ROMs, Indexe de la LV des attributs non conserve, Array des ROMs) 292 | ProgressOn(_MultiLang_GetText("prbr_suppr_rom_title"), "", "0%") 293 | $A_LV_SUPPRESS = _GUIListViewEx_ReturnArray($I_LV_SUPPRESS) 294 | For $B_ROMList = 0 To UBound($A_ROMList) - 1 295 | $V_ProgressPRC = Round(($B_ROMList * 100) / (UBound($A_ROMList) - 1)) 296 | ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_suppr_rom_progress") & $V_ProgressPRC & "%") 297 | For $B_LV_SUPPRESS = 0 To UBound($A_LV_SUPPRESS) - 1 298 | If StringInStr($A_ROMList[$B_ROMList][0], "(" & $A_LV_SUPPRESS[$B_LV_SUPPRESS] & ")") > 0 Then $A_ROMList[$B_ROMList][2] = "SUPPR" 299 | Next 300 | Next 301 | ;~ _ArrayDisplay($A_ROMList, '$A_ROMList Completed') ; Debug 302 | ProgressOff() 303 | Return $A_ROMList 304 | EndFunc ;==>_SUPPR_ROM 305 | 306 | Func _CLEAN_ROM($V_ROMPath, $A_ROMList, $TMP_Action = 0) ;Nettoyage des ROMs (Chemin des ROMs, Array des ROMs, Action = 0-Simulation;1-Nettoyage) 307 | ProgressOn(_MultiLang_GetText("prbr_clean_rom_title"), "", "0%") 308 | $A_ROMList_CLEAN = $A_ROMList 309 | Local $FileMoved 310 | 311 | ;~ _ArrayDisplay($A_ROMList_CLEAN, "$A_ROMList_CLEAN Before");Debug 312 | 313 | For $B_ROMList_CLEAN = UBound($A_ROMList_CLEAN) - 1 To 0 Step -1 314 | $V_ProgressPRC = Round((((UBound($A_ROMList_CLEAN) - 1) - $B_ROMList_CLEAN) * 100) / (UBound($A_ROMList_CLEAN) - 1)) 315 | ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_clean_rom_progress0") & $V_ProgressPRC & "%") 316 | If $A_ROMList_CLEAN[$B_ROMList_CLEAN][2] = "SUPPR" Then _ArrayDelete($A_ROMList_CLEAN, $B_ROMList_CLEAN) 317 | Next 318 | 319 | ;~ _ArrayDisplay($A_ROMList_CLEAN, "$A_ROMList_CLEAN After SUPPR");Debug 320 | 321 | For $B_ROMList_CLEAN = UBound($A_ROMList_CLEAN) - 1 To 0 Step -1 322 | $V_ProgressPRC = Round((((UBound($A_ROMList_CLEAN) - 1) - $B_ROMList_CLEAN) * 100) / (UBound($A_ROMList_CLEAN) - 1)) 323 | ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_clean_rom_progress0") & $V_ProgressPRC & "%") 324 | If $B_ROMList_CLEAN <> UBound($A_ROMList_CLEAN) - 1 Then 325 | If $A_ROMList_CLEAN[$B_ROMList_CLEAN][1] = $A_ROMList_CLEAN[$B_ROMList_CLEAN + 1][1] And $A_ROMList_CLEAN[$B_ROMList_CLEAN][2] <> $A_ROMList_CLEAN[$B_ROMList_CLEAN + 1][2] Then _ArrayDelete($A_ROMList_CLEAN, $B_ROMList_CLEAN) 326 | EndIf 327 | Next 328 | 329 | ;~ _ArrayDisplay($A_ROMList_CLEAN, "$A_ROMList_CLEAN After UNIQUE");Debug 330 | 331 | Dim $A_ROMList_SIMUL[UBound($A_ROMList)][4] 332 | For $B_ROMList = 0 To UBound($A_ROMList) - 1 333 | $V_ProgressPRC = Round(($B_ROMList * 100) / (UBound($A_ROMList) - 1)) 334 | ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_clean_rom_progress3") & $V_ProgressPRC & "%") 335 | For $B_ROMList_CLEAN = 0 To UBound($A_ROMList_CLEAN) - 1 336 | If $A_ROMList[$B_ROMList][0] = $A_ROMList_CLEAN[$B_ROMList_CLEAN][0] Then $A_ROMList[$B_ROMList][2] = "KEEP" & $A_ROMList[$B_ROMList][2] 337 | Next 338 | Next 339 | 340 | ;~ _ArrayDisplay($A_ROMList, "$A_ROMList");Debug 341 | 342 | For $B_ROMList = 0 To UBound($A_ROMList) - 1 343 | $V_ProgressPRC = Round(($B_ROMList * 100) / (UBound($A_ROMList_SIMUL) - 1)) 344 | ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_clean_rom_progress4") & $V_ProgressPRC & "%") 345 | If StringLeft($A_ROMList[$B_ROMList][2], 4) = "KEEP" Then 346 | $FileMoved = -1 347 | $A_ROMList_SIMUL[$B_ROMList][0] = "OK" 348 | $A_ROMList_SIMUL[$B_ROMList][3] = StringMid($A_ROMList[$B_ROMList][2], 5) 349 | If $TMP_Action = 1 Then $FileMoved = FileMove($V_ROMPath & $A_ROMList[$B_ROMList][3], $V_ROMPath & "CLEAN_ROM\", BitOR($FC_OVERWRITE, $FC_CREATEPATH)) 350 | Switch $FileMoved 351 | Case 1 352 | $A_ROMList_SIMUL[$B_ROMList][2] = "MOVED" 353 | Case 0 354 | $A_ROMList_SIMUL[$B_ROMList][2] = "ERROR" 355 | Case Else 356 | $A_ROMList_SIMUL[$B_ROMList][2] = "SIMUL" 357 | EndSwitch 358 | 359 | Else 360 | $A_ROMList_SIMUL[$B_ROMList][0] = "KO" 361 | $A_ROMList_SIMUL[$B_ROMList][3] = $A_ROMList[$B_ROMList][2] 362 | EndIf 363 | $A_ROMList_SIMUL[$B_ROMList][1] = $A_ROMList[$B_ROMList][0] 364 | Next 365 | ;~ _ArrayDisplay($A_ROMList_SIMUL, "$A_ROMList_SIMUL");Debug 366 | _FileWriteFromArray($path_SIMUL, $A_ROMList_SIMUL) 367 | 368 | ;~ If $TMP_Action = 1 Then 369 | ;~ For $B_ROMList_CLEAN = 0 To UBound($A_ROMList_CLEAN) - 1 370 | ;~ $V_ProgressPRC = Round(($B_ROMList_CLEAN * 100) / (UBound($A_ROMList_CLEAN) - 1)) 371 | ;~ ProgressSet($V_ProgressPRC, _MultiLang_GetText("prbr_clean_rom_progress2") & $V_ProgressPRC & "%") 372 | ;~ FileMove($V_ROMPath & $A_ROMList_CLEAN[$B_ROMList_CLEAN][0], $V_ROMPath & "CLEAN_ROM\", BitOR($FC_OVERWRITE, $FC_CREATEPATH)) 373 | ;~ Next 374 | ;~ ProgressOff() 375 | ;~ Else 376 | ProgressOff() 377 | ; Display the file. 378 | If $TMP_Action = 0 Then ShellExecute($path_SIMUL) 379 | ;~ EndIf 380 | EndFunc ;==>_CLEAN_ROM 381 | 382 | Func _LANG_LOAD($LANG_DIR, $user_lang) ;Chargement de la langue (Chemin des fichiers de langues, Id de la langue) 383 | ;Create an array of available language files 384 | ; ** n=0 is the default language file 385 | ; [n][0] = Display Name in Local Language (Used for Select Function) 386 | ; [n][1] = Language File (Full path. In this case we used a $LANG_DIR 387 | ; [n][2] = [Space delimited] Character codes as used by @OS_LANG (used to select correct lang file) 388 | Local $LANGFILES[4][3] 389 | 390 | $LANGFILES[0][0] = "English (US)" ; 391 | $LANGFILES[0][1] = $LANG_DIR & "\URC-ENGLISH.XML" 392 | $LANGFILES[0][2] = "0409 " & _ ;English_United_States 393 | "0809 " & _ ;English_United_Kingdom 394 | "0c09 " & _ ;English_Australia 395 | "1009 " & _ ;English_Canadian 396 | "1409 " & _ ;English_New_Zealand 397 | "1809 " & _ ;English_Irish 398 | "1c09 " & _ ;English_South_Africa 399 | "2009 " & _ ;English_Jamaica 400 | "2409 " & _ ;English_Caribbean 401 | "2809 " & _ ;English_Belize 402 | "2c09 " & _ ;English_Trinidad 403 | "3009 " & _ ;English_Zimbabwe 404 | "3409" ;English_Philippines 405 | 406 | $LANGFILES[1][0] = "Francais" ; French 407 | $LANGFILES[1][1] = $LANG_DIR & "\URC-FRENCH.XML" 408 | $LANGFILES[1][2] = "040c " & _ ;French_Standard 409 | "080c " & _ ;French_Belgian 410 | "0c0c " & _ ;French_Canadian 411 | "100c " & _ ;French_Swiss 412 | "140c " & _ ;French_Luxembourg 413 | "180c" ;French_Monaco 414 | 415 | $LANGFILES[2][0] = "Deutsch" ; German 416 | $LANGFILES[2][1] = $LANG_DIR & "\URC-GERMAN.XML" 417 | $LANGFILES[2][2] = "0407 " & _ ;German - Germany 418 | "0807 " & _ ;German - Switzerland 419 | "0C07 " & _ ;German - Austria 420 | "1007 " & _ ;German - Luxembourg 421 | "1407 " ;German - Liechtenstein 422 | 423 | $LANGFILES[3][0] = "Español" ; Spanish 424 | $LANGFILES[3][1] = $LANG_DIR & "\URC-SPANISH.XML" 425 | $LANGFILES[3][2] = "040A " & _ ;Spanish - Spain 426 | "080A " & _ ;Spanish - Mexico 427 | "0C0A " & _ ;Spanish - Spain 428 | "100A " & _ ;Spanish - Guatemala 429 | "140A " & _ ;Spanish - Costa Rica 430 | "180A " & _ ;Spanish - Panama 431 | "1C0A " & _ ;Spanish - Dominican Republic 432 | "200A " & _ ;Spanish - Venezuela 433 | "240A " & _ ;Spanish - Colombia 434 | "280A " & _ ;Spanish - Peru 435 | "2C0A " & _ ;Spanish - Argentina 436 | "300A " & _ ;Spanish - Ecuador 437 | "340A " & _ ;Spanish - Chile 438 | "380A " & _ ;Spanish - Uruguay 439 | "3C0A " & _ ;Spanish - Paraguay 440 | "400A " & _ ;Spanish - Bolivia 441 | "440A " & _ ;Spanish - El Salvador 442 | "480A " & _ ;Spanish - Honduras 443 | "4C0A " & _ ;Spanish - Nicaragua 444 | "500A " & _ ;Spanish - Puerto Rico 445 | "540A " ;Spanish - United State 446 | 447 | ;Set the available language files, names, and codes. 448 | _MultiLang_SetFileInfo($LANGFILES) 449 | If @error Then 450 | MsgBox(48, "Error", "Could not set file info. Error Code " & @error) 451 | Exit 452 | EndIf 453 | ;Check if the loaded settings file exists. If not ask user to select language. 454 | If $user_lang = -1 Then 455 | ;Create Selection GUI 456 | _MultiLang_LoadLangFile(StringLower(@OSLang)) 457 | $user_lang = _LANGUE_SelectGUI($LANGFILES, StringLower(@OSLang), -1) 458 | ;~ $user_lang = _LANGUE_SelectGUI($LANGFILES) 459 | If @error Then 460 | MsgBox(48, "Error", "Could not create selection GUI. Error Code " & @error) 461 | Exit 462 | EndIf 463 | IniWrite($PathConfigINI, "LAST_USE", "$user_lang", $user_lang) 464 | EndIf 465 | Local $ret = _MultiLang_LoadLangFile($user_lang) 466 | If @error Then 467 | MsgBox(48, "Error", "Could not load lang file. Error Code " & @error) 468 | Exit 469 | EndIf 470 | ;If you supplied an invalid $user_lang, we will load the default language file 471 | If $ret = 2 Then 472 | MsgBox(64, "Information", "Just letting you know that we loaded the default language file") 473 | EndIf 474 | 475 | Return $LANGFILES 476 | EndFunc ;==>_LANG_LOAD 477 | 478 | Func _LANGUE_SelectGUI($_gh_aLangFileArray, $default = @OSLang, $demarrage = 0) ;Interface de selection de la langue (Array des langues, langue par defaut) 479 | If $demarrage = 0 Then GUISetState(@SW_DISABLE, $F_UniversalCleaner) 480 | If $_gh_aLangFileArray = -1 Then Return SetError(1, 0, 0) 481 | If IsArray($_gh_aLangFileArray) = 0 Then Return SetError(1, 0, 0) 482 | Local $_multilang_gui_GUI = GUICreate(_MultiLang_GetText("win_sel_langue_Title"), 230, 100) 483 | Local $_multilang_gui_Combo = GUICtrlCreateCombo("(" & _MultiLang_GetText("win_sel_langue_Title") & ")", 8, 48, 209, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) 484 | Local $_multilang_gui_Button = GUICtrlCreateButton(_MultiLang_GetText("win_sel_langue_button"), 144, 72, 75, 25) 485 | Local $_multilang_gui_Label = GUICtrlCreateLabel(_MultiLang_GetText("win_sel_langue_text"), 8, 8, 212, 33) 486 | ;Create List of available languages 487 | For $i = 0 To UBound($_gh_aLangFileArray) - 1 488 | GUICtrlSetData($_multilang_gui_Combo, $_gh_aLangFileArray[$i][0], "(" & _MultiLang_GetText("win_sel_langue_Title") & ")") 489 | Next 490 | GUISetState(@SW_SHOW) 491 | While 1 492 | $nMsg = GUIGetMsg() 493 | Switch $nMsg 494 | Case -3, $_multilang_gui_Button 495 | ExitLoop 496 | EndSwitch 497 | WEnd 498 | Local $_selected = GUICtrlRead($_multilang_gui_Combo) 499 | GUIDelete($_multilang_gui_GUI) 500 | For $i = 0 To UBound($_gh_aLangFileArray) - 1 501 | If StringInStr($_gh_aLangFileArray[$i][0], $_selected) Then 502 | If $demarrage = 0 Then 503 | GUISetState(@SW_ENABLE, $F_UniversalCleaner) 504 | WinActivate($F_UniversalCleaner) 505 | EndIf 506 | Return StringLeft($_gh_aLangFileArray[$i][2], 4) 507 | EndIf 508 | Next 509 | If $demarrage = 0 Then 510 | GUISetState(@SW_ENABLE, $F_UniversalCleaner) 511 | WinActivate($F_UniversalCleaner) 512 | EndIf 513 | Return $default 514 | EndFunc ;==>_LANGUE_SelectGUI 515 | 516 | Func _EXPORTATTRIB($V_ROMPath) 517 | $A_EX_SUPPRESS = _GUIListViewEx_ReturnArray($I_LV_SUPPRESS) 518 | _FileWriteFromArray(@ScriptDir & "\SUPPR.txt", $A_EX_SUPPRESS) 519 | $A_EX_ATTRIBUTE = _GUIListViewEx_ReturnArray($I_LV_ATTRIBUTE) 520 | _FileWriteFromArray(@ScriptDir & "\ATTRIB.txt", $A_EX_ATTRIBUTE) 521 | $A_EX_IGNORE = _GUIListViewEx_ReturnArray($I_LV_IGNORE) 522 | _FileWriteFromArray(@ScriptDir & "\IGNORE.txt", $A_EX_IGNORE) 523 | MsgBox(0, "EXPORT", "La liste des Attributs est Exportée : SUPPR.txt, ATTRIB.txt et IGNORE.txt dans : " & @ScriptDir) 524 | EndFunc ;==>_EXPORTATTRIB 525 | 526 | Func _IMPORTATTRIB($V_ROMPath) 527 | _FileReadToArray(@ScriptDir & "\SUPPR.txt", $A_ROMAttribut) 528 | _ArrayDelete($A_ROMAttribut, 0) 529 | For $B_ROMAttribut = 0 To UBound($A_ROMAttribut) - 1 530 | _GUICtrlListView_AddItem($H_LV_SUPPRESS, $A_ROMAttribut[$B_ROMAttribut]) 531 | Next 532 | _FileReadToArray(@ScriptDir & "\IGNORE.txt", $A_ROMAttribut) 533 | _ArrayDelete($A_ROMAttribut, 0) 534 | For $B_ROMAttribut = 0 To UBound($A_ROMAttribut) - 1 535 | _GUICtrlListView_AddItem($H_LV_IGNORE, $A_ROMAttribut[$B_ROMAttribut]) 536 | Next 537 | _FileReadToArray(@ScriptDir & "\ATTRIB.txt", $A_ROMAttribut) 538 | _ArrayDelete($A_ROMAttribut, 0) 539 | Return $A_ROMAttribut 540 | EndFunc ;==>_IMPORTATTRIB 541 | --------------------------------------------------------------------------------