Hier meine Version mit Speicherfunktion:
Spoiler anzeigen
#include <Array.au3>
$sFilename = @ScriptDir & '\Hitparade2.txt'
$sSaveFile = @ScriptDir & '\Interpreten-1000.txt'
$aInterpreten = StringRegExp(FileRead($sFilename), '.+;(\V+)', 3)
;~ _ArrayDisplay($aInterpreten)
$aModal = _ArrayModal($aInterpreten)
_ArrayDisplay($aModal)
$hFile = FileOpen($sSaveFile, 2)
If $hFile <> -1 Then
For $i = 0 To UBound($aModal) - 1
FileWriteLine($hFile, $aModal[$i][0] & ';' & $aModal[$i][1])
Next
FileClose($hFile)
EndIf
Func _ArrayModal($w)
Local Static $oDictionary = ObjCreate('Scripting.Dictionary')
$oDictionary.CompareMode = 1
For $i = 0 To UBound($w) - 1
If $oDictionary.Exists($w[$i]) Then
$oDictionary.Item($w[$i]) = $oDictionary.Item($w[$i]) + 1
Else
$oDictionary.Add($w[$i], 1)
EndIf
Next
Local $aOut[$oDictionary.Count][2], $i = 0, $colKeys
$colKeys = $oDictionary.Keys
For $strKey In $colKeys
$aOut[$i][0] = $strKey
$aOut[$i][1] = $oDictionary.Item($strKey)
$i += 1
Next
$oDictionary = ''
_ArraySort($aOut, 1, 0, 0, 1)
Return $aOut
EndFunc ;==>_ArrayModal