ich hab den code von oscars mp3 doublefinder mal abgeändert un würde nun gerne einbauen , dass er alle doppelten dateien öffnet(fileopen) und dann vergleicht kann mir da jmd helfen
Spoiler anzeigen
If Not FileExists(@ScriptDir & '\sys\LevenshteinDistance.dll') Then Exit MsgBox(16, $sTitle, '"LevenshteinDistance.dll" konnte nicht gefunden werden!')
Global $hDLL = DllOpen(@ScriptDir & '\sys\LevenshteinDistance.dll')
Global $sAppDir = @AppDataDir & '\MP3-Double-Finder'
If Not FileExists($sAppDir) Then DirCreate($sAppDir)
Global $sIniPath = $sAppDir & '\MP3-Double-Finder.ini'
Global $sSearchPath = IniRead($sIniPath, 'Prefs', 'SearchPath', @MyDocumentsDir & '\')
Global $LVExStyle = BitOR($WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT)
Global $iStop = False
Global $hFuzzy[4], $oShellApp = ObjCreate('Shell.Application')
HotKeySet('{ESC}', '_StopSearch')
$hGui = GUICreate($sTitle & " " & Chr(169) & 'by Oscar (http://www.autoit.de)', 800, 600)
GUISetOnEvent($GUI_EVENT_CLOSE, '_End')
GUISetBkColor(0xE8E8E8)
GUISetIcon(@ScriptDir & '\prog.ico')
GUICtrlCreateGroup('Suchparameter', 10, 10, 780, 115)
GUICtrlCreateIcon(@SystemDir & '\shell32.dll', -46, 20, 26, 32, 32)
$hSearchPath = GUICtrlCreateInput($sSearchPath, 60, 30, 680, 22)
GUICtrlSetFont(-1, 10, 400, 0, 'Courier New')
GUICtrlSetTip(-1, 'Das Verzeichnis wird rekursiv (inkl. aller Unterverzeichnisse) durchsucht!', 'Suchverzeichnis', 1, 1)
$hSelDir = GUICtrlCreateButton('...', 740, 29, 32, 24)
GUICtrlSetOnEvent(-1, '_SelectSearchpath')
GUICtrlSetFont(-1, 14, 400)
$hSelLog = GUICtrlCreateCheckbox('Logdatei im Anwendungsverzeichnis erstellen', 60, 60, 300, 16)
GUICtrlSetFont(-1, 10, 400)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetTip(-1, '"' & $sAppDir & '"', 'Anwendungsverzeichnis', 1, 1)
$hSelID3 = GUICtrlCreateCheckbox('auch Doppelte laut ID3-Tags anzeigen', 60, 80, 380, 16)
GUICtrlSetFont(-1, 10, 400)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetState(-1, $GUI_DISABLE)
$hFuzzy[0] = GUICtrlCreateCheckbox('auch ähnliche Dateinamen anzeigen', 60, 100, 380, 16)
GUICtrlSetFont(-1, 10, 400)
GUICtrlSetState(-1, $GUI_UNCHECKED)
GUICtrlSetOnEvent(-1, '_ChangeSelFuzzy')
GUICtrlSetState(-1, $GUI_DISABLE)
$hFuzzy[1] = GUICtrlCreateInput('90', 460, 99, 48, 20, BitOR($ES_NUMBER, $ES_RIGHT))
GUICtrlSetOnEvent(-1, '_ChangeFuzzy')
GUICtrlSetFont(-1, 10, 400)
GUICtrlSetState(-1, $GUI_HIDE)
$hFuzzy[2] = GUICtrlCreateUpdown(-1)
GUICtrlSetState(-1, $GUI_HIDE)
$hFuzzy[3] = GUICtrlCreateLabel('prozentige Ähnlichkeit (min.)', 514, 100, 190, 16)
GUICtrlSetFont(-1, 10, 400)
GUICtrlSetState(-1, $GUI_HIDE)
GUICtrlCreateGroup('', -99, -99, 1, 1)
$hStart = GUICtrlCreateButton('Suche starten...', 20, 132, 180, 25)
GUICtrlSetFont(-1, 10, 400)
GUICtrlSetOnEvent(-1, '_StartSearch')
$hProgr = GUICtrlCreateProgress(210, 133, 560, 23)
GUICtrlSetState(-1, $GUI_HIDE)
$hSearchGroup = GUICtrlCreateGroup('Ergebnis der Suche', 10, 165, 780, 420)
GUICtrlCreateLabel('MP3-Dateien:', 30, 185, 110, 25)
GUICtrlSetFont(-1, 12, 400, 0, 'Verdana')
$hCountAll = GUICtrlCreateLabel('0', 150, 185, 100, 25)
GUICtrlSetFont(-1, 12, 600, 0, 'Verdana')
GUICtrlCreateLabel('Doppelte:', 330, 185, 80, 25)
GUICtrlSetFont(-1, 12, 400, 0, 'Verdana')
$hCountDouble = GUICtrlCreateLabel('0', 420, 185, 100, 25)
GUICtrlSetFont(-1, 12, 600, 0, 'Verdana')
$hListView = GUICtrlCreateListView('Dateiname (inkl. Pfad)|Dateigröße (Bytes)|ID3-Titel|ID3-Interpet|Laufzeit|Bitrate', 25, 215, 750, 330, Default, $LVExStyle)
$hLVContext = GUICtrlCreateContextMenu($hListView)
GUICtrlCreateMenuItem('MP3-Player start', $hLVContext)
GUICtrlSetOnEvent(-1, '_PlayMP3')
GUICtrlCreateMenuItem('MP3-Player stop', $hLVContext)
GUICtrlSetOnEvent(-1, '_StopMP3')
$hLVDel = GUICtrlCreateMenu('markierte Datei', $hLVContext)
GUICtrlCreateMenuItem('in Papierkorb verschieben', $hLVDel)
GUICtrlSetOnEvent(-1, '_RecycleItem')
GUICtrlCreateMenuItem('sofort löschen', $hLVDel)
GUICtrlSetOnEvent(-1, '_DelItem')
_GUICtrlListView_SetColumnWidth($hListView, 0, 615)
_GUICtrlListView_SetColumn($hListView, 1, 'Dateigröße (Bytes)', 110, 1)
GUICtrlCreateLabel('', 30, 560, 20, 18, Default, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0x66FF66)
GUICtrlCreateLabel('', 50, 560, 20, 18, Default, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0xAAFFAA)
GUICtrlCreateLabel('= Doppelt (Dateiname)', 75, 560, 200, 18)
GUICtrlSetFont(-1, 10, 400, 0, 'Verdana')
GUICtrlCreateLabel('', 280, 560, 20, 18, Default, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0xFF6666)
GUICtrlCreateLabel('', 300, 560, 20, 18, Default, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0xFF9999)
GUICtrlCreateLabel('= Doppelt (ID3-Tags)', 325, 560, 200, 18)
GUICtrlSetFont(-1, 10, 400, 0, 'Verdana')
#cs
GUICtrlCreateLabel('', 530, 560, 20, 18, Default, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0x6666FF)
GUICtrlCreateLabel('', 550, 560, 20, 18, Default, $WS_EX_STATICEDGE)
GUICtrlSetBkColor(-1, 0x9999FF)
GUICtrlCreateLabel('= Doppelt (Dateiname ähnlich)', 575, 560, 210, 18)
GUICtrlSetFont(-1, 10, 400, 0, 'Verdana')
GUICtrlCreateGroup('', -99, -99, 1, 1)
#ce
GUISetState()
While True
Sleep(1000)
_GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
WEnd
Func _End()
DllClose($hDLL)
Exit
EndFunc ;==>_End
Func _CompTstr($s, $t) ; Funktion und LevenshteinDistance.dll von bernd670 (http://www.autoit.de)
Local $n, $m ; ohne diese DLL würde es die Ähnlichkeitssuche nicht geben
$n = StringLen($s) ; Danke, Bernd!
$m = StringLen($t)
If $n < $m Then $n = $m
$arDLL = DllCall($hDLL, 'int', 'LevenshteinDistance', 'str', $s, 'str', $t)
If IsArray($arDLL) Then Return ($n - $arDLL[0]) / $n
EndFunc ;==>_CompTstr
Func _ChangeFuzzy()
Local $iVal = GUICtrlRead($hFuzzy[1])
If $iVal < 1 Then GUICtrlSetData($hFuzzy[1], 1)
If $iVal > 99 Then GUICtrlSetData($hFuzzy[1], 99)
EndFunc ;==>_ChangeFuzzy
Func _PlayMP3()
Local $iSelect, $sSelItem
$iSelect = ControlListView($hGui, '', $hListView, 'GetSelected')
If $iSelect = '' Then Return
$sSelItem = ControlListView($hGui, '', $hListView, 'GetText', $iSelect, 0)
SoundPlay($sSelItem)
EndFunc ;==>_PlayMP3
Func _StopMP3()
SoundPlay('')
EndFunc ;==>_StopMP3
Func _RecycleItem()
Local $iSelect, $sSelItem, $iRet = 1
$iSelect = ControlListView($hGui, '', $hListView, 'GetSelected')
If $iSelect = '' Then Return
$sSelItem = ControlListView($hGui, '', $hListView, 'GetText', $iSelect, 0)
$iRet = FileRecycle($sSelItem)
If $iRet Then
_GUICtrlListView_DeleteItemsSelected($hListView)
GUICtrlSetData($hCountAll, GUICtrlRead($hCountAll) - 1)
GUICtrlSetData($hCountDouble, GUICtrlRead($hCountDouble) - 1)
Else
MsgBox(48, $sTitle, 'Datei konnte nicht in den Papierkorb verschoben werden!', 0, $hGui)
EndIf
EndFunc ;==>_RecycleItem
Func _DelItem()
Local $iSelect, $sSelItem, $iRet
$iSelect = ControlListView($hGui, '', $hListView, 'GetSelected')
If $iSelect = '' Then Return
$sSelItem = ControlListView($hGui, '', $hListView, 'GetText', $iSelect, 0)
$iRet = FileDelete($sSelItem)
If $iRet Then
_GUICtrlListView_DeleteItemsSelected($hListView)
GUICtrlSetData($hCountAll, GUICtrlRead($hCountAll) - 1)
GUICtrlSetData($hCountDouble, GUICtrlRead($hCountDouble) - 1)
Else
MsgBox(48, $sTitle, 'Datei konnte nicht gelöscht werden!', 0, $hGui)
EndIf
EndFunc ;==>_DelItem
Func _ChangeSelFuzzy()
If BitAND(GUICtrlRead($hFuzzy[0]), $GUI_CHECKED) Then
GUICtrlSetState($hFuzzy[1], $GUI_SHOW)
GUICtrlSetState($hFuzzy[2], $GUI_SHOW)
GUICtrlSetState($hFuzzy[3], $GUI_SHOW)
Else
GUICtrlSetState($hFuzzy[1], $GUI_HIDE)
GUICtrlSetState($hFuzzy[2], $GUI_HIDE)
GUICtrlSetState($hFuzzy[3], $GUI_HIDE)
EndIf
EndFunc ;==>_ChangeSelFuzzy
Func _SelectSearchpath()
Local $sPath
$sPath = FileSelectFolder('Bitte Verzeichnis auswählen', @DesktopDir, 2, $sSearchPath, $hGui)
If @error Then Return
If FileExists($sPath) Then
$sSearchPath = $sPath
If StringRight($sSearchPath, 1) <> '\' Then $sSearchPath &= '\'
GUICtrlSetData($hSearchPath, $sSearchPath)
_ClearListView()
GUICtrlSetData($hCountAll, 0)
GUICtrlSetData($hCountDouble, 0)
IniWrite($sIniPath, 'Prefs', 'SearchPath', $sSearchPath)
Else
_PlayDefaultSystemSound('SystemAsterisk') ; Danke, funkey!
EndIf
EndFunc ;==>_SelectSearchpath
Func _ClearListView()
_GUICtrlListView_BeginUpdate($hListView)
_GUICtrlListView_DeleteAllItems($hListView)
_GUICtrlListView_EndUpdate($hListView)
EndFunc ;==>_ClearListView
Func _StopSearch()
$iStop = True
EndFunc ;==>_StopSearch
Func _CloseToolTip()
AdlibUnRegister()
ToolTip('')
EndFunc ;==>_CloseToolTip
Func _StartSearch()
Local $aFiles, $aPos = WinGetPos($hGui), $sMsg
GUICtrlSetState($hStart, $GUI_DISABLE)
GUICtrlSetData($hCountAll, 0)
GUICtrlSetData($hCountDouble, 0)
GUICtrlSetData($hSearchGroup, 'Ergebnis der Suche')
_ClearListView()
$sMsg = 'Bitte warten! Verzeichnis wird eingelesen!' & @CRLF & @CRLF & 'Abbruch mit [ESC]-Taste möglich.'
$iStop = False
ToolTip($sMsg, $aPos[0] + 420, $aPos[1] + 175, $sTitle, 1, 3)
$aFiles = _RecursiveFileListToArray($sSearchPath, '.+\.mp3', 1, 1)
GUICtrlSetData($hCountAll, $aFiles[0])
If $aFiles[0] = 0 Then
_PlayDefaultSystemSound('SystemAsterisk') ; Danke, funkey!
GUICtrlSetState($hStart, $GUI_ENABLE)
ToolTip('')
Return
EndIf
$sMsg = $aFiles[0] & ' Dateien gefunden' & @CRLF & 'Bitte warten! Doppelte werden gesucht!' & @CRLF & @CRLF & 'Abbruch mit [ESC]-Taste möglich.'
ToolTip($sMsg, $aPos[0] + 420, $aPos[1] + 175, $sTitle, 1, 3)
GUICtrlSetData($hProgr, 0)
GUICtrlSetState($hProgr, $GUI_SHOW)
Local $oDictionary = ObjCreate('Scripting.Dictionary')
Local $oID3 = ObjCreate('Scripting.Dictionary')
Local $oDir, $oFile
Local $sFilename, $iPercent, $iFuzzyPar, $iFuzzySum
Local $aColor[2] = [0x66FF66, 0xAAFFAA], $iColor = False
Local $aID3Color[2] = [0xFF6666, 0xFF9999], $iID3Color = False
Local $aFuzzyColor[2] = [0x8888FF, 0xAAAAFF], $iFuzzyColor = False
Local $iFileSize, $sID3Title, $sID3Artist, $sID3Duration, $sID3Bitrate, $sID3Info
$iFuzzyPar = GUICtrlRead($hFuzzy[1]) / 100
AdlibRegister('_CloseToolTip', 5000)
Local $iTimer = TimerInit(), $sRuntime
For $i = 1 To $aFiles[0]
If $iStop Then
_PlayDefaultSystemSound('SystemAsterisk') ; Danke, funkey!
GUICtrlSetData($hSearchGroup, 'Suche abgebrochen')
GUICtrlSetState($hStart, $GUI_ENABLE)
ExitLoop
EndIf
$iPercent = Int(100 / $aFiles[0] * $i)
GUICtrlSetData($hProgr, $iPercent)
$sFilename = StringTrimRight(StringTrimLeft($aFiles[$i], StringInStr($aFiles[$i], '\', 1, -1)), 4)
If $oDictionary.Exists($sFilename) Then
_CreateLVItem($oDictionary.Item($sFilename), $aColor, $iColor)
_CreateLVItem($aFiles[$i], $aColor, $iColor)
GUICtrlSetData($hCountDouble, GUICtrlRead($hCountDouble) + 1)
$iColor = Not $iColor
ContinueLoop
Else
$oDictionary.Add($sFilename, $aFiles[$i])
EndIf
If BitAND(GUICtrlRead($hSelID3), $GUI_CHECKED) Then
$oDir = $oShellApp.NameSpace(StringLeft($aFiles[$i], StringInStr($aFiles[$i], '\', 1, -1)))
$oFile = $oDir.Parsename(StringTrimLeft($aFiles[$i], StringInStr($aFiles[$i], '\', 1, -1)))
$sID3Title = $oDir.GetDetailsOf($oFile, $aID3Index[0])
$sID3Artist = $oDir.GetDetailsOf($oFile, $aID3Index[1])
If $sID3Title = '' Or $sID3Artist = '' Then ContinueLoop
$sID3Duration = $oDir.GetDetailsOf($oFile, $aID3Index[2])
$sID3Bitrate = $oDir.GetDetailsOf($oFile, $aID3Index[3])
$sID3Info = $sID3Title & '|' & $sID3Artist & '|' & $sID3Duration & '|' & $sID3Bitrate
If $oID3.Exists($sID3Info) Then
_CreateLVItem($oID3.Item($sID3Info), $aID3Color, $iID3Color)
$iFileSize = _StringAddThousandsSep(FileGetSize($aFiles[$i]), '.')
GUICtrlCreateListViewItem($aFiles[$i] & '|' & $iFileSize & '|' & $sID3Info, $hListView)
GUICtrlSetBkColor(-1, $aID3Color[$iID3Color])
GUICtrlSetData($hCountDouble, GUICtrlRead($hCountDouble) + 1)
$iID3Color = Not $iID3Color
Else
$oID3.Add($sID3Info, $aFiles[$i])
EndIf
EndIf
If BitAND(GUICtrlRead($hFuzzy[0]), $GUI_CHECKED) Then
For $j = $i + 1 To $aFiles[0]
$iFuzzySum = _CompTstr($sFilename, StringTrimRight(StringTrimLeft($aFiles[$j], StringInStr($aFiles[$j], '\', 1, -1)), 4))
If $iFuzzySum >= $iFuzzyPar And $iFuzzySum < 1 Then
_CreateLVItem($aFiles[$j], $aFuzzyColor, $iFuzzyColor)
_CreateLVItem($aFiles[$i], $aFuzzyColor, $iFuzzyColor)
GUICtrlSetData($hCountDouble, GUICtrlRead($hCountDouble) + 1)
$iFuzzyColor = Not $iFuzzyColor
EndIf
Next
EndIf
Next
If TimerDiff($iTimer) < 5000 Then _CloseToolTip()
$sRuntime = _NewTicksToTime(TimerDiff($iTimer))
If BitAND(GUICtrlRead($hSelLog), $GUI_CHECKED) Then _CreateLogfile($sRuntime)
_PlayDefaultSystemSound('SystemExclamation') ; Danke, funkey!
_GUICtrlListView_SetColumnWidth($hListView, 2, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($hListView, 3, $LVSCW_AUTOSIZE)
GUICtrlSetState($hProgr, $GUI_HIDE)
GUICtrlSetState($hStart, $GUI_ENABLE)
EndFunc ;==>_StartSearch
Func _CreateLVItem($sFilename, ByRef $aColor, $iColor)
Local $oDir, $oFile
$oDir = $oShellApp.NameSpace(StringLeft($sFilename, StringInStr($sFilename, '\', 1, -1)))
$oFile = $oDir.Parsename(StringTrimLeft($sFilename, StringInStr($sFilename, '\', 1, -1)))
$sID3Title = $oDir.GetDetailsOf($oFile, $aID3Index[0])
$sID3Artist = $oDir.GetDetailsOf($oFile, $aID3Index[1])
$sID3Duration = $oDir.GetDetailsOf($oFile, $aID3Index[2])
$sID3Bitrate = $oDir.GetDetailsOf($oFile, $aID3Index[3])
$iFileSize = _StringAddThousandsSep(FileGetSize($sFilename), '.')
GUICtrlCreateListViewItem($sFilename & '|' & $iFileSize & '|' & $sID3Title & '|' & $sID3Artist & '|' & $sID3Duration & '|' & $sID3Bitrate, $hListView)
GUICtrlSetBkColor(-1, $aColor[$iColor])
EndFunc ;==>_CreateLVItem
Func _CreateLogfile($sRuntime)
Local $sLogfile = $sAppDir & '\' & @YEAR & @MON & @MDAY & '_' & @HOUR & @MIN & @SEC & '.log'
Local $hFile = FileOpen($sLogfile, 2)
If $hFile <> -1 Then
FileWriteLine($hFile, $sTitle)
FileWriteLine($hFile, 'Suchverzeichnis = "' & $sSearchPath & '"')
FileWriteLine($hFile, ' gefundene MP3s = ' & GUICtrlRead($hCountAll))
FileWriteLine($hFile, 'Benötigte Zeit (hh:mm:ss.msec) = ' & $sRuntime)
FileWriteLine($hFile, 'Doppelte Dateien: ' & GUICtrlRead($hCountDouble))
For $i = 0 To _GUICtrlListView_GetItemCount($hListView) - 1
FileWriteLine($hFile, StringReplace(_GUICtrlListView_GetItemTextString($hListView, $i), '|', @TAB))
Next
FileClose($hFile)
ShellExecute('notepad.exe', $sLogfile)
EndIf
EndFunc ;==>_CreateLogfile
Func _NewTicksToTime($iTicks)
Local $iHours, $iMins, $iSecs = Int($iTicks / 1000), $iMSecs = $iTicks - $iSecs * 1000
$iHours = Int($iSecs / 3600)
$iSecs = Mod($iSecs, 3600)
$iMins = Int($iSecs / 60)
$iSecs = Mod($iSecs, 60)
Return StringFormat('%02i:%02i:%02i.%03i', $iHours, $iMins, $iSecs, $iMSecs)
EndFunc ;==>_NewTicksToTime
;===============================================================================
; Function Name: _RecursiveFileListToArray($sPath[, $sPattern][, $iFlag][, $iFormat][, $iRecursion][, $sDelim])
; Description:: gibt Verzeichnisse und/oder Dateien (rekursiv) zurück, die einem RegExp-Pattern entsprechen
; Parameter(s): $sPath = Startverzeichnis
; $sPattern = ein beliebiges RexExp-Pattern für die Auswahl
; $iFlag = Auswahl
; 0 = Dateien & Verzeichnisse
; 1 = nur Dateien
; 2 = nur Verzeichnisse
; $iFormat = Rückgabeformat
; 0 = String
; 1 = Array mit [0] = Anzahl
; 2 = Nullbasiertes Array
; $iRecursion = Verzeichnisse rekursiv durchsuchen
; 0 = Nein
; 1 = Ja
; $sDelim = Trennzeichen für die String-Rückgabe
; Requirement(s): AutoIt 3.3.0.0
; Return Value(s): Array/String mit den gefundenen Dateien/Verzeichnissen
; Author(s): Oscar (http://www.autoit.de)
; Anregungen von: bernd670 (http://www.autoit.de)
;===============================================================================
Func _RecursiveFileListToArray($sPath, $sPattern = '', $iFlag = 0, $iFormat = 1, $iRecursion = 1, $sDelim = @CRLF)
Local $hSearch, $sReturn = '', $sFile
If StringRight($sPath, 1) <> '\' Then $sPath &= '\'
$hSearch = FileFindFirstFile($sPath & '*.*')
If @error Or $hSearch = -1 Then Return SetError(0, 0, $sReturn)
While True
$sFile = FileFindNextFile($hSearch)
If @error Then ExitLoop
If $iStop Then ; diese If-Anweisung ist für den MP3-Double-Finder hinzugefügt
$sReturn = ''
ExitLoop
EndIf
If StringInStr(FileGetAttrib($sPath & $sFile), 'D') Then
If StringRegExp($sPath & $sFile, $sPattern) And ($iFlag = 0 Or $iFlag = 2) Then $sReturn &= $sPath & $sFile & '\' & $sDelim
If $iRecursion Then $sReturn &= _RecursiveFileListToArray($sPath & $sFile & '\', $sPattern, $iFlag, 0)
ContinueLoop
EndIf
If StringRegExp($sFile, $sPattern) And ($iFlag = 0 Or $iFlag = 1) Then $sReturn &= $sPath & $sFile & $sDelim
WEnd
FileClose($hSearch)
If $iFormat And $sReturn = '' Then Return StringSplit($sReturn, '', $iFormat)
If $iFormat Then Return StringSplit(StringTrimRight($sReturn, StringLen($sDelim)), $sDelim, $iFormat)
Return $sReturn
EndFunc ;==>_RecursiveFileListToArray
; #FUNCTION# ====================================================================================================================
; Name...........: _PlayDefaultSystemSound()
; Description ...: Spielt einen Systemklang, welcher in der Registry definiert ist.
; Syntax.........: _PlayDefaultSystemSound($sSoundName, $iWait = 0)
; Parameters ....: $sSoundName - Name des SystemSound's
; | Default - Standardton Warnsignal / Default Beep
; | CriticalBatteryAlarm - Alarm bei kritischem Batteriestand / when battery is critical
; | DeviceConnect - Geräteanschluß / when a device is connect
; | DeviceDisconnect - Gerätetrennung / when a device is disconnect
; | DeviceFail - Geräteanschluß fehlgeschlagen / when a deviceconnect is fail
; | LowBatteryAlarm - Alarm bei niedrigem Batteriestand / when battery is low
; | MailBeep - Posteingangsbenachrichtigung / when email is received
; | SystemAsterisk - Stern / Asterisk
; | SystemExclamation - Hinweis / when windows shows a warning
; | SystemExit - Windows beenden / when Windows shuts down
; | SystemHand - Kritischer Abbruch / when a critical stop occurs
; | SystemNotification - Sprechblase / when a critical stop occurs
; | SystemStart - Windows starten / when Windows starts up
; | WindowsLogoff - beim Windows abmelden / when logging off Windows
; | WindowsLogon - beim Windows anmelden / when logging on Windows
; | EmptyRecycleBin - Löschen des Papierkorbs / when recycle bin is emptied
; | Navigating - Browser Klick / navigating in browser
; $iWait - Warten bis SoundPlay beendet? (0 = nein / 1 = ja)
; Return values .: -----
; Author ........: funkey (AutoIt.de)
; ===============================================================================================================================
Func _PlayDefaultSystemSound($sSoundName, $iWait = 0) ; funkey
Local $sKey = 'HKEY_USERS\.Default\AppEvents\Schemes\Apps\.Default'
If $sSoundName = 'EmptyRecycleBin' Or $sSoundName = 'Navigating' Then $sKey = 'HKEY_USERS\.Default\AppEvents\Schemes\Apps\Explorer'
Local $sFile = StringReplace(RegRead($sKey & '\' & $sSoundName & '\.Default', ''), '%SystemRoot%', @WindowsDir)
If $sFile = "" Then
SoundPlay(StringReplace(RegRead($sKey & '\.Default\.Default', ''), '%SystemRoot%', @WindowsDir), $iWait)
Else
SoundPlay($sFile, $iWait)
EndIf
EndFunc ;==>_PlayDefaultSystemSound
; #FUNCTION# ====================================================================================================================
; Name...........: _StringAddThousandsSep
; Description ...: Returns the original numbered string with the Thousands delimiter inserted.
; Syntax.........: _StringAddThousandsSep($sString[, $sThousands = -1[, $sDecimal = -1]])
; Parameters ....: $sString - The string to be converted.
; $sThousands - Optional: The Thousands delimiter
; $sDecimal - Optional: The decimal delimiter
; Return values .: Success - The string with Thousands delimiter added.
; Author ........: SmOke_N (orignal _StringAddComma
; Modified.......: Valik (complete re-write, new function name)
; ===============================================================================================================================
Func _StringAddThousandsSep($sString, $sThousands = -1, $sDecimal = -1)
Local $sResult = "" ; Force string
Local $rKey = "HKCU\Control Panel\International"
If $sDecimal = -1 Then $sDecimal = RegRead($rKey, "sDecimal")
If $sThousands = -1 Then $sThousands = RegRead($rKey, "sThousand")
Local $aNumber = StringRegExp($sString, "(\D?\d+)\D?(\d*)", 1) ; This one works for negatives.
If UBound($aNumber) = 2 Then
Local $sLeft = $aNumber[0]
While StringLen($sLeft)
$sResult = $sThousands & StringRight($sLeft, 3) & $sResult
$sLeft = StringTrimRight($sLeft, 3)
WEnd
$sResult = StringTrimLeft($sResult, StringLen($sThousands)) ; Strip leading thousands separator
If $aNumber[1] <> "" Then $sResult &= $sDecimal & $aNumber[1]
EndIf
Return $sResult
EndFunc ;==>_StringAddThousandsSep
vg
JuraX