1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. TheSystemAlien

Beiträge von TheSystemAlien

  • Problem mit Dateizugriff

    • TheSystemAlien
    • 24. November 2013 um 11:39

    Hab schon gedacht, dass ich was vergessen hab.. 8|
    Naja, hier noch die fehlenden Dateien.

    Danke für eure Bemühungen!

    Dateien

    IncludeFiles.zip 344,44 kB – 241 Downloads
  • Problem mit Dateizugriff

    • TheSystemAlien
    • 21. November 2013 um 19:14

    Tach Leute

    Nach unendlichen Versuchen und langer Suche im Netz sehe ich mich wiedermal gezwungen, eure Hilfe in Anspruch zu nehmen.
    Ich schreibe gerade an einem Programm, dass es mir ermöglichen soll, doppelte Musikdateien in einem Ordner zu finden und direkt zu bearbeiten. Also ich will die Dateien aus dem Programm heraus löschen, umbenennen oder verschieben. Das Umbenennen und Löschen funktioniert einwandfrei.
    Beim Verschieben jedoch bekommt er ein Problem mit einem geöffneten Dateihandle. Ich kann mir nicht erklären, warum das Handle zu dieser Datei nicht geschlossen wird (entdeckt hab ich's mit der procmon.exe von Sysinternals). Die zweite Datei bleibt immer vom Programm geöffnet, obwohl FileClose bzw. SoundClose angegeben ist. Dadurch schlägt entweder das Löschen oder das Verschieben fehl.
    Das Problem betrifft den Code von Zeile 921 bis Zeile 988.
    Der in diesem Bereich auskommentierte Code stellt die eigentliche Funktion dar. Die Variante mit dem Objekt hab ich versucht, als ich gemerkt hab, dass die andere nicht funktioniert..

    Um das zu Testen braucht man ein Lied in einem Ordner, mit einer Kopie davon in einem weiteren Unterordner.

    Ich hoffe, Ihr könnt mir Helfen, bin kurz vorm Verzweifeln.. ?(

    Script:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ------------------------ DoubleKill v0.1 ----------------- by TheAlien ---------

    [/autoit] [autoit][/autoit] [autoit]

    TODO:
    - "suche abbrechen" funktioniert nicht richtig

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;~ ---------------------------------------------------------------------------------------------------
    C:\Program Files (x86)\AutoIt3\Include\Sound.au3 (346) : ==> Subscript used with non-Array variable.:
    __SoundMciSendString("set " & $aSndID[0] & " time format miliseconds")
    __SoundMciSendString("set " & $aSndID^ ERROR
    ->23:33:13 AutoIt3.exe ended.rc:1

    [/autoit] [autoit][/autoit] [autoit]

    -------------------------------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.8.1
    Author: TheSystemAlien ([email='brother-of-blood@hotmail.com'][/email])

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Programm, um doppelte Musik-Dateien in einem Ordner zu finden und gleichzeitig zu bearbeiten (umbenennen, löschen, verschieben usw...).

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    #NoTrayIcon
    #RequireAdmin

    [/autoit] [autoit][/autoit] [autoit]

    #Region
    #AutoIt3Wrapper_icon=tab_duplicate.ico
    #AutoIt3Wrapper_outfile=DoubleKill v0.1.exe
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_UseX64=n
    #AutoIt3Wrapper_Res_Description=DoubleKill
    #AutoIt3Wrapper_Res_Fileversion=0.1
    #AutoIt3Wrapper_Res_LegalCopyright=by TheAlien
    #AutoIt3Wrapper_Res_Language=1031
    #AutoIt3Wrapper_Run_After=ResHacker.exe -add %out%, %out%, DefSettings.ini, rcdata, DEFSETTINGS, 0
    #Obfuscator_Parameters=/striponly
    #EndRegion
    #include <GuiListBox.au3>
    #include <GuiListView.au3>
    #include <EditConstants.au3>
    #include <Array.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Constants.au3>
    #include <Date.au3>
    #include <UpdownConstants.au3>
    #include <Misc.au3>
    #include <GuiButton.au3>
    #include <GuiSlider.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #include "_Sound.au3"
    #include "_GuiRichEdit.au3"
    #include "resources.au3"
    #Include <ColorChooser.au3>
    #include <WinAPIEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GuiOnEventMode", 1)
    Opt("MustDeclareVars", 1)

    [/autoit] [autoit][/autoit] [autoit]

    #region Global Vars
    Global $sTitle = "DoubleKill v0.1 by TheAlien"
    ;~ Global $a_Titles[100000] ;==> wird in der Funktion _Scan deklariert
    ;==> Array, in welchen die gefundenen Titel geladen werden
    Global $iStop = False
    ;==> Für den Abbruch des Scans
    Global $hSettings = "settings.ini"
    ;==> Pfad zur Einstellungsdatei
    Global $hIgnoreList = "ignorelist.txt", $sIgnoreList
    ;==> Pfad zur Liste, die die zu ignorierenden Einträge enthält
    Global $iVolume, $iPlay = -1, $iPause, $iPlayer
    ;==> $iVolume -> Lautstärke
    ;==> $iPlay -> Abspielstatus: -1 = keine Sounds geladen, 0 = Stop, 1 = Play
    ;==> $iPause -> Pause: 1 = pause, 0 != pause
    ;==> $iPlayer -> welcher Player gerade aktiv ist: 0 = player links, 1 = player rechts
    Global $hSound
    ;==> Handle zum Sound
    Global $i_PairCount
    ;==> Anzahl gefundener Paare
    Global $__ASKSCAN, $__ASKDELSINGLE, $__ASKDELDOUBLE, $__ASKCLOSE, $__AUTOPLAY, $__SKIPTIME, $__IGNORENEXTTIME
    ;==> Nachfragen und Einstellungen, selbsterklärend
    Global $aFunctions[24], $aShortCuts[24], $AccelKeys[24][2]
    ;==> Für die zuweisung mit GuiSetAccelerators(): $aFunctions = Handle zu den Controls, $aShortCuts = Tastenkürzel im Send-Format
    Global $aDupes[1][2]
    ;==> $aDupes[0][0] = Erstes Paar, erster track... $aDupes[0][1] = Erstes Paar, zweiter Track (mit Dateipfaden)
    Global $Color, $aControls[8][2]
    ;==> $Color = aktuelle Farbe im Auswahlfenster, $aControls = Array um Buttons und Farblabel zu verwalten
    Global $iSettingsActive = False
    #endregion Global Vars

    [/autoit] [autoit][/autoit] [autoit]

    If Not FileExists($hSettings) Then
    _ResourceSaveToFile("settings.ini", "DEFSETTINGS")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _ReadIgnoreList()

    [/autoit] [autoit][/autoit] [autoit]

    #region Colors

    [/autoit] [autoit][/autoit] [autoit]

    ;~ Global Const $COLOR1 = 0xBDBDBD ;==> default colors
    ;~ Global Const $COLOR2 = 0xDCDCDC
    ;~ Global Const $COLOR3 = 0x000000
    ;~ Global Const $COLOR4 = 0x228B22
    ;~ Global Const $COLOR5 = 0xFF8C00
    ;~ Global Const $COLOR6 = 0x0080FF
    ;~ Global Const $COLOR7 = 0x009900
    ;~ Global Const $COLOR8 = 0xEE2C2C
    Global $COLOR1 = IniRead($hSettings, "Settings", "Color1", 0xBDBDBD)
    Global $COLOR2 = IniRead($hSettings, "Settings", "Color2", 0xDCDCDC)
    Global $COLOR3 = IniRead($hSettings, "Settings", "Color3", 0x000000)
    Global $COLOR4 = IniRead($hSettings, "Settings", "Color4", 0x228B22)
    Global $COLOR5 = IniRead($hSettings, "Settings", "Color5", 0xFF8C00)
    Global $COLOR6 = IniRead($hSettings, "Settings", "Color6", 0x0080FF)
    Global $COLOR7 = IniRead($hSettings, "Settings", "Color7", 0x009900)
    Global $COLOR8 = IniRead($hSettings, "Settings", "Color8", 0xEE2C2C)
    #endregion Colors

    [/autoit] [autoit][/autoit] [autoit]

    #Region GUI Main
    Global $hGUI = GUICreate($sTitle, 617, 665)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    GUISetBkColor($COLOR1)
    GUICtrlSetDefColor($COLOR3, $hGUI)
    Global $hFileMenu = GUICtrlCreateMenu("&Datei")
    Global $hFileMenu_open = GUICtrlCreateMenuItem("Pfad öffnen"&@TAB&"F4", $hFileMenu)
    GUICtrlSetOnEvent(-1, "_OpenPath")
    Global $hFileMenu_scan = GUICtrlCreateMenuItem("Scannen"&@TAB&"F5", $hFileMenu)
    GUICtrlSetOnEvent(-1, "_Scan")
    ;~ $ = GUICtrlCreateMenuItem(""&@TAB&"F17", $hFileMenu)
    Global $hFileMenu_new = GUICtrlCreateMenuItem("Neue Instanz"&@TAB&"F2", $hFileMenu)
    GUICtrlSetOnEvent(-1, "_NewInstance")
    Global $hFileMenu_close = GUICtrlCreateMenuItem("DoubleKill beenden"&@TAB&"ESC", $hFileMenu)
    GUICtrlSetOnEvent(-1, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    Global $hOptionsMenu = GUICtrlCreateMenu("&Optionen")
    Global $hOptionsMenu_Settings = GUICtrlCreateMenuItem("Einstellungen"&@TAB&"F9", $hOptionsMenu)
    GUICtrlSetOnEvent(-1, "_ToggleSettings")
    Global $hOptionsMenu_Color = GUICtrlCreateMenuItem("Farb-Einstellungen"&@TAB&"F10", $hOptionsMenu)
    GUICtrlSetOnEvent(-1, "_ToggleColor")
    Global $hHelpMenu = GUICtrlCreateMenu("&Hilfe")
    Global $hHelpMenu_About = GUICtrlCreateMenuItem("Über DoubleKill"&@TAB&"F1", $hHelpMenu)
    GUICtrlSetOnEvent(-1, "_ToggleAbout")

    [/autoit] [autoit][/autoit] [autoit]

    Global $Group1 = GUICtrlCreateGroup("Titel 1", 8, 8, 257, 197)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group1), "wstr", 0, "wstr", 0)
    Global $e_infos_left = _GUICtrlRichEdit_Create($hGUI,"", 16, 24, 185, 130, BitOR($ES_MULTILINE, $ES_READONLY))
    _GUICtrlRichEdit_SetBkColor($e_infos_left, $COLOR2)
    Global $timeslide_left = GUICtrlCreateSlider(16, 163, 240, 21)
    GUICtrlSetBkColor(-1, $COLOR1)
    GUICtrlSetLimit(-1, 500)
    GUICtrlSetOnEvent(-1, "_SeekPosition")
    Global $l_SoundPosleft = GUICtrlCreateLabel("00:00", 24, 187, 40, 15)

    [/autoit] [autoit][/autoit] [autoit]

    Global $l_SoundLenleft = GUICtrlCreateLabel("00:00", 218, 187, 30, 15)

    [/autoit] [autoit][/autoit] [autoit]

    Global $b_playleft = GUICtrlCreateButton("Play", 208, 20, 51, 25)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetOnEvent(-1, "_TogglePlay")
    Global $b_stopleft = GUICtrlCreateButton("Stop", 208, 48, 51, 25)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetOnEvent(-1, "_StopMusic")
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $b_rename_left = GUICtrlCreateButton("Rename", 208, 76, 51, 25)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetOnEvent(-1, "_RenameFile")
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $b_delete_left = GUICtrlCreateButton("Löschen", 208, 132, 51, 25)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetOnEvent(-1, "_DeleteFile")
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $b_move_left = GUICtrlCreateButton("Versch.", 208, 104, 51, 25)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetOnEvent(-1, "_MoveFile")
    GUICtrlSetState(-1, $GUI_DISABLE)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $Group2 = GUICtrlCreateGroup("Titel 2", 272, 8, 257, 197)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group2), "wstr", 0, "wstr", 0)
    Global $e_infos_right = _GUICtrlRichEdit_Create($hGUI,"", 280, 24, 185, 130, BitOR($ES_MULTILINE, $ES_READONLY))
    _GUICtrlRichEdit_SetBkColor($e_infos_right, $COLOR2)
    Global $timeslide_right = GUICtrlCreateSlider(280, 163, 240, 21)
    GUICtrlSetBkColor(-1, $COLOR1)
    GUICtrlSetLimit(-1, 500)
    GUICtrlSetOnEvent(-1, "_SeekPosition")
    Global $l_SoundPosright = GUICtrlCreateLabel("00:00", 288, 187, 40, 15)
    Global $l_SoundLenright = GUICtrlCreateLabel("00:00", 482, 187, 30, 15)
    Global $b_delete_right = GUICtrlCreateButton("Löschen", 472, 132, 51, 25)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetOnEvent(-1, "_DeleteFile")
    Global $b_rename_right = GUICtrlCreateButton("Rename", 472, 76, 51, 25)
    GUICtrlSetOnEvent(-1, "_RenameFile")
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $b_playright = GUICtrlCreateButton("Play", 472, 20, 51, 25)
    GUICtrlSetOnEvent(-1, "_TogglePlay")
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $b_stopright = GUICtrlCreateButton("Stop", 472, 48, 51, 25)
    GUICtrlSetOnEvent(-1, "_StopMusic")
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $b_move_right = GUICtrlCreateButton("Versch.", 472, 104, 51, 25)
    GUICtrlSetOnEvent(-1, "_MoveFile")
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $Group3 = GUICtrlCreateGroup("Gefundene Tracks", 8, 353, 600, 200)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group3), "wstr", 0, "wstr", 0)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hListBox = GUICtrlCreateList("", 16, 376, 580, 162, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
    GUICtrlSetBkColor($hListBox, $COLOR2)
    GUICtrlSetData(-1, "")
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $Group4 = GUICtrlCreateGroup("Dateipfade", 8, 212, 600, 133)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group4), "wstr", 0, "wstr", 0)
    Global $i_path_left = _GUICtrlRichEdit_Create($hGUI, "", 16, 257, 582, 21, $ES_READONLY)
    _GUICtrlRichEdit_SetBkColor($i_path_left, $COLOR2)
    Global $b_open_left = GUICtrlCreateButton("Dateispeicherort öffnen", 469, 226, 131, 25)
    GUICtrlSetOnEvent(-1, "_OpenInExplorer")
    GUICtrlSetState(-1, $GUI_DISABLE)
    Global $i_path_right = _GUICtrlRichEdit_Create($hGUI, "", 16, 285, 582, 21, $ES_READONLY)
    _GUICtrlRichEdit_SetBkColor($i_path_right, $COLOR2)
    Global $b_open_right = GUICtrlCreateButton("Dateispeicherort öffnen", 469, 313, 131, 25)
    GUICtrlSetOnEvent(-1, "_OpenInExplorer")
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlCreateLabel("Titel 1", 16, 236, 33, 17)
    GUICtrlCreateLabel("Titel 2", 16, 312, 33, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $Group5 = GUICtrlCreateGroup("Pfad zur Musiksammlung", 8, 556, 600, 80)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group5), "wstr", 0, "wstr", 0)
    Global $i_Path = GUICtrlCreateInput("", 16, 573, 500, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_READONLY))
    GUICtrlSetBkColor(-1, $COLOR2)
    Global $b_openpath = GUICtrlCreateButton("Pfad öffnen", 521, 573, 80, 25)
    GUICtrlSetOnEvent(-1, "_OpenPath")
    Global $b_scan = GUICtrlCreateButton("Scannen", 521, 603, 80, 25)
    GUICtrlSetOnEvent(-1, "_Scan")
    GUICtrlCreateLabel("Aktueller Ordner:", 16, 603, 60, 25)
    Global $l_ActualDir = GUICtrlCreateLabel("", 76, 603, 430, 25)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel("Anzahl Tracks:", 536, 17, 75, 13)

    [/autoit] [autoit][/autoit] [autoit]

    Global $l_CountTracks = GUICtrlCreateLabel("0", 536, 32, 75, 13)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel("Anzahl Paare:", 536, 47, 75, 17)

    [/autoit] [autoit][/autoit] [autoit]

    Global $l_CountPairs = GUICtrlCreateLabel("0", 536, 62, 75, 13)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel("Volume:", 536, 78, 75, 17)
    Global $i_volume = GUICtrlCreateInput("0", 538, 93, 70, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_NUMBER))
    GUICtrlSetBkColor(-1, $COLOR2)
    Global $ud_volume = GUICtrlCreateUpdown($i_volume, BitOR($UDS_ARROWKEYS, $UDS_ALIGNRIGHT))
    GUICtrlSetLimit(-1, 100, 0)
    Global $b_deleteboth = GUICtrlCreateButton("Beide löschen", 536, 119, 75, 25)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetOnEvent(-1, "_DeleteBoth")
    Global $b_holdboth = GUICtrlCreateButton("Eintrag weiter", 536, 145, 75, 25)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUICtrlSetOnEvent(-1, "_NextEntry")
    Global $cb_ignorenexttime = GUICtrlCreateCheckbox("Nächstes", 536, 175, 75, 18)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($cb_ignorenexttime), "wstr", 0, "wstr", 0)
    GUICtrlCreateLabel("Mal ignorieren", 538, 192, 71, 18)

    [/autoit] [autoit][/autoit] [autoit]

    Global $d_skipback = GUICtrlCreateDummy()
    GUICtrlSetOnEvent(-1, "_SkipBackward")
    Global $d_skipforward = GUICtrlCreateDummy()
    GUICtrlSetOnEvent(-1, "_SkipForward")
    Global $d_stopsearch = GUICtrlCreateDummy()
    GUICtrlSetOnEvent(-1, "_AbortScan")
    Global $d_ignorenexttime = GUICtrlCreateDummy()
    GUICtrlSetOnEvent(-1, "_ToggleIgnore")
    Global $d_volumeup = GUICtrlCreateDummy()
    GUICtrlSetOnEvent(-1, "_VolumeUp")
    Global $d_volumedown = GUICtrlCreateDummy()
    GUICtrlSetOnEvent(-1, "_VolumeDown")
    Global $d_settings = GUICtrlCreateDummy()
    GUICtrlSetOnEvent(-1, "_ToggleSettings")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    #region Settings GUI
    Global $hGui_Settings = GUICreate($sTitle & " - Einstellungen", 393, 448, Default, Default, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), $hGui)
    GUISetBkColor($COLOR1)
    GUICtrlSetDefColor($COLOR3, $hGui_Settings)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_ToggleSettings")
    Global $Group_ask = GUICtrlCreateGroup("Nachragen beim..", 8, 8, 177, 129)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group_ask), "wstr", 0, "wstr", 0)
    Global $cb_ask_scan = GUICtrlCreateCheckbox("Scannen", 16, 32, 97, 17)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($cb_ask_scan), "wstr", 0, "wstr", 0)
    Global $cb_ask_delsingle = GUICtrlCreateCheckbox("Löschen einzelner Tracks", 16, 56, 145, 17)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($cb_ask_delsingle), "wstr", 0, "wstr", 0)
    Global $cb_ask_deldouble = GUICtrlCreateCheckbox("Löschen beider Tracks", 16, 80, 129, 17)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($cb_ask_deldouble), "wstr", 0, "wstr", 0)
    Global $cb_ask_close = GUICtrlCreateCheckbox("Schliessen", 16, 104, 97, 17)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($cb_ask_close), "wstr", 0, "wstr", 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $Group_player = GUICtrlCreateGroup("Player Einstellungen", 200, 8, 185, 129)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group_player), "wstr", 0, "wstr", 0)
    Global $cb_player_autoplay = GUICtrlCreateCheckbox("Automatisch abspielen", 208, 32, 129, 17)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($cb_player_autoplay), "wstr", 0, "wstr", 0)
    GUICtrlCreateLabel("Schrittgrösse beim Spulen (Sek.)", 208, 56, 157, 17)
    Global $i_skiptime = GUICtrlCreateInput("", 208, 75, 157, 22, $ES_NUMBER)
    GUICtrlSetBkColor(-1, $COLOR2)
    Global $ud_skiptime = GUICtrlCreateUpdown($i_skiptime, BitOR($UDS_ARROWKEYS, $UDS_ALIGNRIGHT))
    GUICtrlSetLimit(-1, 100, 3)
    Global $b_colors = GUICtrlCreateButton("Farben auswählen", 208, 103, 157, 25)
    GUICtrlSetOnEvent(-1, "_ToggleColor")
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $Group_shortcuts = GUICtrlCreateGroup("Tastaturbefehle", 8, 144, 377, 265)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group_shortcuts), "wstr", 0, "wstr", 0)
    Global $h_ListViewSettings = _GUICtrlListView_Create($hGui_Settings, "Aktion|Tastaturbefehl", 16, 168, 361, 227)
    _GUICtrlListView_SetColumnWidth($h_ListViewSettings, 0, 200)
    _GUICtrlListView_SetColumnWidth($h_ListViewSettings, 1, 90)
    _GUICtrlListView_SetExtendedListViewStyle($h_ListViewSettings, $LVS_EX_FULLROWSELECT)
    _GUICtrlListView_SetBkColor($h_ListViewSettings, $COLOR2)
    _GUICtrlListView_SetTextBkColor($h_ListViewSettings, $COLOR2)
    _GUICtrlListView_SetTextColor($h_ListViewSettings, $COLOR3)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $b_setstandard = GUICtrlCreateButton("Standard wiederherstellen", 8, 415, 150, 25)
    GUICtrlSetOnEvent(-1, "_ResetSettings")
    Global $b_abort = GUICtrlCreateButton("Abbrechen", 163, 415, 67, 25)
    GUICtrlSetOnEvent(-1, "_ToggleSettings")
    Global $b_savesettings = GUICtrlCreateButton("Speichern und schliessen", 235, 415, 150, 25)
    GUICtrlSetOnEvent(-1, "_SaveSettings")

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_HIDE, $hGui_Settings)
    #endregion Settings GUI

    [/autoit] [autoit][/autoit] [autoit]

    #region GUI Shortcut Countdown
    Global $hGUI_Shorcut = GUICreate("Form1", 165, 106, Default, Default, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST)
    GUISetBkColor($COLOR1)
    GUICtrlSetDefColor($COLOR3, $hGUI_Shorcut)
    GUICtrlCreateLabel("Taste drücken...", 33, 27, 99, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    Global $l_time = GUICtrlCreateLabel("0", 77, 59, 50, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUISetState(@SW_HIDE, $hGUI_Shorcut)
    #endregion GUI Shortcut Countdown

    [/autoit] [autoit][/autoit] [autoit]

    #region GUI About
    Global $hGui_About = GUICreate("", 200, 500, Default, Default, BitOR($WS_POPUP, $WS_BORDER))
    GUISetOnEvent($GUI_EVENT_CLOSE, "_ToggleAbout")
    GUISetBkColor($COLOR1, $hGui_About)
    GUICtrlSetDefColor($COLOR3, $hGui_About)
    Global $b_CloseAbout = GUICtrlCreateButton("Schliessen", 5, 470, 190, 25)
    Global $e_about = GUICtrlCreateEdit("", 5, 5, 190, 460, BitOR($ES_READONLY, $ES_CENTER))
    GUICtrlSetOnEvent($b_CloseAbout, "_ToggleAbout")
    #endregion GUI About

    [/autoit] [autoit][/autoit] [autoit]

    #region GUI Colors
    Global $hGui_Color = GUICreate($sTitle & " - Farben", 340, 240, Default, Default, BitOR($WS_POPUP, $WS_BORDER))
    GUISetBkColor($COLOR1, $hGui_Color)
    GUICtrlSetDefColor($COLOR3, $hGui_Color)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_ToggleColor")
    Global $Group1 = GUICtrlCreateGroup("Farben auswählen für...", 12, 8, 317, 190)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle($Group1), "wstr", 0, "wstr", 0)
    Global $Label1 = GUICtrlCreateLabel("GUI Hintergrundfarbe", 24, 28, 105, 17)
    Global $Label2 = GUICtrlCreateLabel("GUI Sekundärfarbe", 24, 48, 96, 17)
    Global $Label3 = GUICtrlCreateLabel("GUI Schriftfarbe", 24, 68, 96, 17)
    GUICtrlSetTip(-1, "Benötigt Neustart von DoubleKill")
    Global $Label4 = GUICtrlCreateLabel("Beginn des Pfades", 24, 88, 93, 17)
    Global $Label5 = GUICtrlCreateLabel("Mitte des Pfades", 24, 108, 83, 17)
    Global $Label6 = GUICtrlCreateLabel("Ende des Pfades", 24, 128, 85, 17)
    Global $Label7 = GUICtrlCreateLabel("Kleiner als", 24, 148, 51, 17)
    Global $Label8 = GUICtrlCreateLabel("Grösser als", 24, 168, 57, 17)
    Global $b_pick1 = GUICtrlCreateButton("Pick", 280, 28, 43, 17)
    GUICtrlSetOnEvent(-1, "_GetColor")
    Global $b_pick2 = GUICtrlCreateButton("Pick", 280, 48, 43, 17)
    GUICtrlSetOnEvent(-1, "_GetColor")
    Global $b_pick3 = GUICtrlCreateButton("Pick", 280, 68, 43, 17)
    GUICtrlSetOnEvent(-1, "_GetColor")
    GUICtrlSetTip(-1, "Benötigt Neustart von DoubleKill")
    Global $b_pick4 = GUICtrlCreateButton("Pick", 280, 88, 43, 17)
    GUICtrlSetOnEvent(-1, "_GetColor")
    Global $b_pick5 = GUICtrlCreateButton("Pick", 280, 108, 43, 17)
    GUICtrlSetOnEvent(-1, "_GetColor")
    Global $b_pick6 = GUICtrlCreateButton("Pick", 280, 128, 43, 17)
    GUICtrlSetOnEvent(-1, "_GetColor")
    Global $b_pick7 = GUICtrlCreateButton("Pick", 280, 148, 43, 17)
    GUICtrlSetOnEvent(-1, "_GetColor")
    Global $b_pick8 = GUICtrlCreateButton("Pick", 280, 168, 43, 17)
    GUICtrlSetOnEvent(-1, "_GetColor")
    Global $l_Color1 = GUICtrlCreateLabel("", 136, 28, 140, 17, $SS_SUNKEN)
    Global $l_Color2 = GUICtrlCreateLabel("", 136, 48, 140, 17, $SS_SUNKEN)
    Global $l_Color3 = GUICtrlCreateLabel("", 136, 68, 140, 17, $SS_SUNKEN)
    GUICtrlSetTip(-1, "Benötigt Neustart von DoubleKill")
    Global $l_Color4 = GUICtrlCreateLabel("", 136, 88, 140, 17, $SS_SUNKEN)
    Global $l_Color5 = GUICtrlCreateLabel("", 136, 108, 140, 17, $SS_SUNKEN)
    Global $l_Color6 = GUICtrlCreateLabel("", 136, 128, 140, 17, $SS_SUNKEN)
    Global $l_Color7 = GUICtrlCreateLabel("", 136, 148, 140, 17, $SS_SUNKEN)
    Global $l_Color8 = GUICtrlCreateLabel("", 136, 168, 140, 17, $SS_SUNKEN)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    Global $b_colors_abort = GUICtrlCreateButton("Abbrechen", 10, 205, 105, 25)
    GUICtrlSetOnEvent(-1, "_ToggleColor")
    Global $b_colors_apply = GUICtrlCreateButton("Übernehmen", 118, 205, 105, 25)
    GUICtrlSetOnEvent(-1, "_ApplyColors")
    Global $b_colors_ok = GUICtrlCreateButton("Ok", 225, 205, 105, 25)
    GUICtrlSetOnEvent(-1, "_ApplyColors")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #endregion GUI Colors

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") ;==> für doppelklick in der listbox
    GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ;==> für tastendruck in den einstellungen

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetData($i_Path, IniRead($hSettings, "Settings", "LastPath", ""))
    GUICtrlSetData($i_volume, IniRead($hSettings, "Settings", "Volume", "50"))
    ;~ [["1", $b_deleteboth],["2", $b_playleft],["3", $b_playright], _
    ;~ ["4", $b_holdboth],["q", $b_rename_left],["w", $d_skipback],["e", $d_skipforward], _
    ;~ ["r", $b_rename_right],["a", $b_open_left],["s", $b_delete_left],["d", $b_delete_right], _
    ;~ ["f", $b_open_right],["x", $b_stopleft],["c", $b_stopright],["{ESC}", $d_stopsearch]]
    ;~ _ArrayDisplay($AccelKeys)
    GUISetAccelerators($AccelKeys, $hGUI)

    [/autoit] [autoit][/autoit] [autoit]

    _LoadSettings()
    _ApplySettings()
    _ReadColors()

    [/autoit] [autoit][/autoit] [autoit]

    AdlibRegister("_UpdateControls", 200)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $iVolume = GUICtrlRead($i_volume)
    $__SKIPTIME = GUICtrlRead($i_skiptime)
    Sleep(400)
    If $iVolume <> GUICtrlRead($i_volume) Then
    SoundSetWaveVolume(GUICtrlRead($i_volume))
    IniWrite($hSettings, "Settings", "Volume", GUICtrlRead($i_volume))
    EndIf
    If GuiCtrlRead($timeslide_left) = 500 Or GuiCtrlRead($timeslide_right) = 500 Then _StopMusic()
    If $iVolume > 100 Then GUICtrlSetData($i_volume, StringLeft($iVolume, 2))
    If $__SKIPTIME > 100 Then GUICtrlSetData($i_skiptime, StringLeft($__SKIPTIME, 2))
    If $__SKIPTIME < 3 Then GUICtrlSetData($i_skiptime, 3)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    #region Easter Eggs
    Func _ToggleTeaTime()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    #endregion Easter Eggs

    [/autoit] [autoit][/autoit] [autoit]

    #region GUI-Funktionen
    Func _NewInstance()
    Run(@ScriptName)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ToggleIgnore()
    If GUICtrlRead($cb_ignorenexttime) = 4 Then
    GUICtrlSetState($cb_ignorenexttime, $GUI_CHECKED)
    Else
    GUICtrlSetState($cb_ignorenexttime, $GUI_UNCHECKED)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ToggleSettings()
    Local $aGUISettingsState = WinGetState($hGui_Settings)
    If BitAND($aGUISettingsState, 8) And BitAND($aGUISettingsState, 2) Then
    GUISetState(@SW_ENABLE, $hGUI)
    GUISetState(@SW_HIDE, $hGui_Settings)
    GUISetState(@SW_DISABLE, $hGui_Settings)
    _ApplySettings()
    Sleep(200)
    _LoadSettings()
    $iSettingsActive = False
    Else
    _LoadSettings()
    _CenterWindow($hGui, $hGui_Settings)
    GUISetState(@SW_ENABLE, $hGui_Settings)
    GUISetState(@SW_SHOWNORMAL, $hGui_Settings)
    GUISetState(@SW_DISABLE, $hGUI)
    $iSettingsActive = True
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ToggleAbout()
    Local $aGUIAboutState = WinGetState($hGui_About)
    If BitAND($aGUIAboutState, 8) And BitAND($aGUIAboutState, 2) Then
    GUISetState(@SW_ENABLE, $hGUI)
    GUISetState(@SW_HIDE, $hGui_About)
    GUISetState(@SW_DISABLE, $hGui_About)
    Else
    GUICtrlSetData($e_about, FileRead("About.txt"))
    _CenterWindow($hGui, $hGui_About)
    GUISetState(@SW_ENABLE, $hGui_About)
    GUISetState(@SW_SHOWNORMAL, $hGui_About)
    GUISetState(@SW_DISABLE, $hGUI)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ToggleColor()
    Local $aGuiColorState = WinGetState($hGui_Color)
    Local $aGUISettingsState = WinGetState($hGui_Settings)
    Local $aGUIState = WinGetState($hGui)
    If BitAND($aGUISettingsState, 8) And BitAND($aGUISettingsState, 2) Then ;==> wenn Settings-Fenster aktiv und sichtbar ist
    If Not (BitAND($aGuiColorState, 8) And BitAND($aGuiColorState, 2)) Then ;==> wenn Farben-Fenster nicht aktiv und sichtbar ist > öffnet farbfenster
    _CenterWindow($hGui, $hGui_Settings)
    GUISetState(@SW_SHOW, $hGui_Color)
    GUISetState(@SW_ENABLE, $hGui_Color)
    GUISetState(@SW_DISABLE, $hGui_Settings)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Else ;==> wenn settings-Fenster nicht aktiv und sichtbar ist
    If BitAND($aGuiColorState, 8) And BitAND($aGuiColorState, 2) And $iSettingsActive = False Then ;==> farbfenster geöffnet und einstellungen nicht > schliesst farbfenster
    GUISetState(@SW_ENABLE, $hGui)
    GUISetState(@SW_HIDE, $hGui_Color)
    GUISetState(@SW_DISABLE, $hGui_Color)
    ElseIf BitAND($aGuiColorState, 8) And BitAND($aGuiColorState, 2) And $iSettingsActive = True Then ;==> farbfenster geöffnet und einstellungen auch > schliesst farbfenster
    GUISetState(@SW_ENABLE, $hGui_Settings)
    GUISetState(@SW_HIDE, $hGui_Color)
    GUISetState(@SW_DISABLE, $hGui_Color)
    Else ;==> zeigt farbfenster wenn einstellungen NICHT geöffnet sind > öffnet farbfenster
    _CenterWindow($hGui, $hGui_Color)
    GUISetState(@SW_DISABLE, $hGui)
    GUISetState(@SW_ENABLE, $hGui_Color)
    GUISetState(@SW_SHOW, $hGui_Color)
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _UpdateControls()
    If $iPlay <> -1 And $iPlayer = 0 Then
    GuiCtrlSetData($timeslide_left, 500 * (1 / (_SoundLength($hSound, 2) / _SoundPos($hSound, 2))))
    GUICtrlSetData($l_SoundPosleft, StringTrimLeft(_SoundPos($hSound), 3))
    ElseIf $iPlay <> -1 and $iPlayer = 1 Then
    GuiCtrlSetData($timeslide_right, 500 * (1 / (_SoundLength($hSound, 2) / _SoundPos($hSound, 2))))
    GUICtrlSetData($l_SoundPosright, StringTrimLeft(_SoundPos($hSound), 3))
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MasterReset()
    GUICtrlSetState($b_deleteboth, $GUI_DISABLE)
    GUICtrlSetState($b_holdboth, $GUI_DISABLE)
    GUICtrlSetState($b_delete_left, $GUI_DISABLE)
    GUICtrlSetState($b_delete_right, $GUI_DISABLE)
    GUICtrlSetState($b_playleft, $GUI_DISABLE)
    GUICtrlSetState($b_playright, $GUI_DISABLE)
    GUICtrlSetState($b_stopleft, $GUI_DISABLE)
    GUICtrlSetState($b_stopright, $GUI_DISABLE)
    GUICtrlSetState($b_rename_left, $GUI_DISABLE)
    GUICtrlSetState($b_rename_right, $GUI_DISABLE)
    GUICtrlSetState($b_open_left, $GUI_DISABLE)
    GUICtrlSetState($b_open_right, $GUI_DISABLE)
    GUICtrlSetState($b_move_left, $GUI_DISABLE)
    GUICtrlSetState($b_move_right, $GUI_DISABLE)

    [/autoit] [autoit][/autoit] [autoit]

    _GUICtrlRichEdit_SetText($i_path_left, "")
    _GUICtrlRichEdit_SetText($i_path_right, "")
    _GUICtrlRichEdit_SetText($e_infos_left, "")
    _GUICtrlRichEdit_SetText($e_infos_right, "")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ClearListBox()
    _GUICtrlListBox_BeginUpdate($hListBox)
    _GUICtrlListBox_ResetContent($hListBox)
    _GUICtrlListBox_EndUpdate($hListBox)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Compare_Path($hControl1, $sPath1, $hControl2, $sPath2)
    Local $sUnequalPath1wFile, $sUnequalPath2wFile, $aEqualFromRight1, $aEqualFromRight2
    Local $sEnding1, $sEnding2, $sEqualFromRight1, $sEqualFromRight2
    Local $sUnequalFromRight1, $sUnequalFromRight2
    Local $aPath1 = StringSplit($sPath1, "")
    If @error Then Return
    Local $aPath2 = StringSplit($sPath2, "")
    If @error Then Return
    For $i = 1 To _SmallerNumber($aPath1[0], $aPath2[0]) - 1
    If $aPath1[$i] = $aPath2[$i] Then
    _GUICtrlRichEdit_WriteLine($hControl1, $aPath1[$i] & "", 0, "", $COLOR4, 0)
    _GUICtrlRichEdit_WriteLine($hControl2, $aPath2[$i] & "", 0, "", $COLOR4, 0)
    EndIf
    Next
    $sUnequalPath1wFile = StringReplace($sPath1, _GUICtrlRichEdit_GetText($hControl1), "")
    $sUnequalPath2wFile = StringReplace($sPath2, _GUICtrlRichEdit_GetText($hControl2), "")
    $sEnding1 = StringRight($sUnequalPath1wFile, 4)
    $sUnequalPath1wFile = StringTrimRight($sUnequalPath1wFile, 4)
    $sEnding2 = StringRight($sUnequalPath2wFile, 4)
    $sUnequalPath2wFile = StringTrimRight($sUnequalPath2wFile, 4)
    $aEqualFromRight1 = StringSplit($sUnequalPath1wFile, "")
    If @error Then

    [/autoit] [autoit][/autoit] [autoit]

    $sUnequalFromRight1 = ""
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $aEqualFromRight2 = StringSplit($sUnequalPath2wFile, "")
    If @error Then

    [/autoit] [autoit][/autoit] [autoit]

    $sUnequalFromRight2 = ""
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If IsArray($aEqualFromRight1) And IsArray($aEqualFromRight2) Then
    Local $iCount = _SmallerNumber($aEqualFromRight1[0], $aEqualFromRight2[0])
    _ArrayReverse($aEqualFromRight1)
    _ArrayReverse($aEqualFromRight2)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To $iCount - 1
    If $aEqualFromRight1[$i] = $aEqualFromRight2[$i] Then
    $sEqualFromRight1 = $aEqualFromRight1[$i] & $sEqualFromRight1
    $sEqualFromRight2 = $aEqualFromRight2[$i] & $sEqualFromRight2
    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    $sUnequalFromRight1 = StringReplace($sUnequalPath1wFile, $sEqualFromRight1, "")
    $sUnequalFromRight2 = StringReplace($sUnequalPath2wFile, $sEqualFromRight2, "")
    Else
    If $sUnequalFromRight1 = "" Then
    $sEqualFromRight1 = $aEqualFromRight1[0] & $sEqualFromRight1
    $sEqualFromRight1 = $sUnequalPath2wFile

    [/autoit] [autoit][/autoit] [autoit]

    ElseIf $sUnequalFromRight2 = "" Then
    $sEqualFromRight2 = $aEqualFromRight2[0] & $sEqualFromRight2
    $sEqualFromRight2 = $sUnequalPath2wFile

    [/autoit] [autoit][/autoit] [autoit]

    EndIf
    EndIf
    ;~
    _GUICtrlRichEdit_WriteLine($hControl1, $sUnequalFromRight1, 0, "", $COLOR5, 0)
    _GUICtrlRichEdit_WriteLine($hControl2, $sUnequalFromRight2, 0, "", $COLOR5, 0)
    _GUICtrlRichEdit_WriteLine($hControl1, $sEqualFromRight1, 0, "", $COLOR6, 0)
    _GUICtrlRichEdit_WriteLine($hControl2, $sEqualFromRight2, 0, "", $COLOR6, 0)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If $sEnding1 = $sEnding2 Then
    _GUICtrlRichEdit_WriteLine($i_path_left, $sEnding1, 0, "", $COLOR6, 0)
    _GUICtrlRichEdit_WriteLine($i_path_right, $sEnding2, 0, "", $COLOR6, 0)
    Else

    [/autoit] [autoit][/autoit] [autoit]

    _GUICtrlRichEdit_WriteLine($i_path_left, $sEnding1, 0, "", $COLOR5, 0)
    _GUICtrlRichEdit_WriteLine($i_path_right, $sEnding2, 0, "", $COLOR5, 0)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _CenterWindow($hWindow1, $hWindow2)
    Local $aGUIPos1 = WinGetPos($hWindow1)
    If @error Then Return
    Local $aGUIPos2 = WinGetPos($hWindow2)
    If @error Then Return
    Local $DesktopWidth = @DesktopWidth
    Local $DesktopHeight = @DesktopHeight
    Local $NewPosX = ($aGUIPos1[0] + $aGUIPos1[2] / 2) - ($aGUIPos2[2] / 2)
    Local $NewPosY = ($aGUIPos1[1] + $aGUIPos1[3] / 2) - ($aGUIPos2[3] / 2)
    WinMove($hWindow2, "", $NewPosX, $NewPosY)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    ; Wirklich Beenden?
    If $__ASKCLOSE = 1 Then
    If MsgBox(292, "Dupes", "Wirklich beenden?") = 6 Then
    _GUICtrlRichEdit_Destroy($e_infos_left)
    _GUICtrlRichEdit_Destroy($e_infos_right)
    _GUICtrlRichEdit_Destroy($i_path_left)
    _GUICtrlRichEdit_Destroy($i_path_right)
    _SoundStop($hSound)
    _SoundClose($hSound)
    Exit
    EndIf
    Else
    _GUICtrlRichEdit_Destroy($e_infos_left)
    _GUICtrlRichEdit_Destroy($e_infos_right)
    _GUICtrlRichEdit_Destroy($i_path_left)
    _GUICtrlRichEdit_Destroy($i_path_right)
    _SoundStop($hSound)
    _SoundClose($hSound)
    Exit
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GUICtrlRichEdit_WriteLine($hWnd, $sText, $iIncrement = 0, $sAttrib = "", $iColor = -1, $iNewLine = 1)

    [/autoit] [autoit][/autoit] [autoit]

    ; Count the @CRLFs
    StringReplace(_GUICtrlRichEdit_GetText($hWnd, True), @CRLF, "")
    Local $iLines = @extended
    ; Adjust the text char count to account for the @CRLFs
    Local $iEndPoint = _GUICtrlRichEdit_GetTextLength($hWnd, True, True) - $iLines
    ; Add new text
    If $iNewLine = 1 Then
    _GUICtrlRichEdit_AppendText($hWnd, $sText & @CRLF)
    Else
    _GUICtrlRichEdit_AppendText($hWnd, $sText)
    EndIf
    ; Select text between old and new end points
    _GuiCtrlRichEdit_SetSel($hWnd, $iEndPoint, -1)
    ; Convert colour from RGB to BGR
    $iColor = Hex($iColor, 6)
    $iColor = '0x' & StringMid($iColor, 5, 2) & StringMid($iColor, 3, 2) & StringMid($iColor, 1, 2)
    ; Set colour
    If $iColor <> -1 Then _GuiCtrlRichEdit_SetCharColor($hWnd, $iColor)
    ; Set size
    If $iIncrement <> 0 Then _GUICtrlRichEdit_ChangeFontSize($hWnd, $iIncrement)
    ; Set weight
    If $sAttrib <> "" Then _GUICtrlRichEdit_SetCharAttributes($hWnd, $sAttrib)
    ; Clear selection
    _GUICtrlRichEdit_Deselect($hWnd)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION# ====================================================================================================================
    ; Name ..........: GUICtrlGetBkColor
    ; Description ...: Retrieves the RGB value of the control background.
    ; Syntax ........: GUICtrlGetBkColor($hWnd)
    ; Parameters ....: $hWnd - Control ID/Handle to the control
    ; Return values .: Success - RGB value
    ; Failure - 0
    ; Author ........: guinness
    ; Remarks .......: WinAPIEx is required.
    ; Example .......: Yes
    ; ===============================================================================================================================
    Func GUICtrlGetBkColor($hWnd)
    If IsHWnd($hWnd) = 0 Then
    $hWnd = GUICtrlGetHandle($hWnd)
    EndIf
    Local $hDC = _WinAPI_GetDC($hWnd)
    Local $iColor = _WinAPI_GetPixel($hDC, 0, 0)
    _WinAPI_ReleaseDC($hWnd, $hDC)
    Return $iColor
    EndFunc
    #endregion GUI-funktionen

    [/autoit] [autoit][/autoit] [autoit]

    #region Player-Funktionen
    Func _TogglePlay()
    Local $iBClicked = @GUI_CtrlHandle
    GUICtrlSetState($b_stopleft, $GUI_ENABLE)
    GUICtrlSetState($b_stopright, $GUI_ENABLE)
    If $iPlay = -1 Then
    If $iBClicked = GUICtrlGetHandle($b_playleft) Then
    $iPlay = 1
    ElseIf $iBClicked = GUICtrlGetHandle($b_playright) Then
    $iPlay = 0
    EndIf
    $iPause = 0
    EndIf
    If $iBClicked = GUICtrlGetHandle($b_playleft) Then
    If $iPlay = 0 Then
    If $iPause = 0 Then
    _SoundPause($hSound)
    GUICtrlSetData($b_playleft, "Play")
    $iPause = 1
    ElseIf $iPause = 1 Then
    _SoundResume($hSound)
    GUICtrlSetData($b_playleft, "Pause")
    $iPause = 0
    EndIf
    ElseIf $iPlay = 1 Then
    _SoundStop($hSound)
    If GUICtrlRead($timeslide_left) = 0 Then
    $hSound = _SoundOpen(_GUICtrlRichEdit_GetText($i_path_left))
    _SoundPlay($hSound)
    Else
    Local $iPos = GUICtrlRead($timeslide_left)
    Local $iTime = _SoundLength($hSound, 2) * 1 / (500 / $iPos)
    Local $sTime = _MStoTimeformat($iTime)
    Local $aTime = StringSplit($sTime, ":")
    _SoundSeek($hSound, $aTime[1], $aTime[2], $aTime[3])
    _SoundPlay($hSound)
    EndIf
    GUICtrlSetData($b_playleft, "Pause")
    GUICtrlSetData($b_playright, "Play")
    EndIf
    $iPlay = 0
    $iPlayer = 0
    ElseIf $iBClicked = GUICtrlGetHandle($b_playright) Then
    If $iPlay = 0 Then
    _SoundStop($hSound)
    If GUICtrlRead($timeslide_right) = 0 Then
    $hSound = _SoundOpen(_GUICtrlRichEdit_GetText($i_path_right))
    _SoundPlay($hSound)
    Else
    Local $iPos = GUICtrlRead($timeslide_right)
    Local $iTime = _SoundLength($hSound, 2) * 1 / (500 / $iPos)
    Local $sTime = _MStoTimeformat($iTime)
    Local $aTime = StringSplit($sTime, ":")
    _SoundSeek($hSound, $aTime[1], $aTime[2], $aTime[3])
    _SoundPlay($hSound)
    EndIf
    GUICtrlSetData($b_playright, "Pause")
    GUICtrlSetData($b_playleft, "Play")
    ElseIf $iPlay = 1 Then
    If $iPause = 0 Then
    _SoundPause($hSound)
    GUICtrlSetData($b_playright, "Play")
    $iPause = 1
    ElseIf $iPause = 1 Then
    _SoundResume($hSound)
    GUICtrlSetData($b_playright, "Pause")
    $iPause = 0
    EndIf
    EndIf
    $iPlay = 1
    $iPlayer = 1
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _SkipBackward()
    Local $iPosTime = _SoundPos($hSound)
    Local $sDatetime = "1980/01/01 " & $iPosTime
    Local $sDiff = _DateAdd("s", $__SKIPTIME * -1, $sDatetime)
    Local $sNewPos = StringSplit(StringRight($sDiff, 8), ":")
    If $iPause = 0 Then
    _SoundSeek($hSound, $sNewPos[1], $sNewPos[2], $sNewPos[3])
    _SoundPlay($hSound)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _SkipForward()
    Local $iPosTime = _SoundPos($hSound)
    Local $sDatetime = "1980/01/01 " & $iPosTime
    Local $sDiff = _DateAdd("s", $__SKIPTIME, $sDatetime)
    Local $sNewPos = StringSplit(StringRight($sDiff, 8), ":")
    If $iPause = 0 Then
    _SoundSeek($hSound, $sNewPos[1], $sNewPos[2], $sNewPos[3])
    _SoundPlay($hSound)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _StopMusic()
    _SoundStop($hSound)
    _SoundClose($hSound)
    FileClose(_GUICtrlRichEdit_GetText($i_path_left))
    FileClose(_GUICtrlRichEdit_GetText($i_path_right))
    $iPlay = -1
    $iPause = 0
    GUICtrlSetState($b_stopleft, $GUI_DISABLE)
    GUICtrlSetState($b_stopright, $GUI_DISABLE)
    GUICtrlSetData($b_playleft, "Play")
    GUICtrlSetData($b_playright, "Play")
    GUICtrlSetData($l_SoundPosleft, "00:00")
    GUICtrlSetData($l_SoundPosright, "00:00")
    GuiCtrlSetData($timeslide_left, 0)
    GuiCtrlSetData($timeslide_right, 0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _SeekPosition()
    Local $iBClicked = @GUI_CtrlHandle, $sTime, $iTime, $aTime
    If $iPlay <> -1 Then
    If $iPause = 0 Then
    If $iBClicked = GUICtrlGetHandle($timeslide_left) And $iPlayer = 0 Then
    Local $iPos = GuiCtrlRead($timeslide_left)
    $iTime = _SoundLength($hSound, 2) * 1 / (500 / $iPos)
    $sTime = _MStoTimeformat($iTime)
    $aTime = StringSplit($sTime, ":")
    _SoundSeek($hSound, $aTime[1], $aTime[2], $aTime[3])
    _SoundPlay($hSound)
    ;~ _MStoTime(GUICtrlRead($timeslide_left))
    ;~ MsgBox(0, "", GUICtrlRead($timeslide_left))
    ElseIf $iBClicked = GUICtrlGetHandle($timeslide_right) And $iPlayer = 1 Then
    Local $iPos = GuiCtrlRead($timeslide_right)
    $iTime = _SoundLength($hSound, 2) * 1 / (500 / $iPos)
    $sTime = _MStoTimeformat($iTime)
    $aTime = StringSplit($sTime, ":")
    _SoundSeek($hSound, $aTime[1], $aTime[2], $aTime[3])
    _SoundPlay($hSound)
    EndIf
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _VolumeUp()
    GUICtrlSetData($i_volume, GUICtrlRead($i_volume) + 1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _VolumeDown()
    GUICtrlSetData($i_volume, GUICtrlRead($i_volume) - 1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    #endregion Player-Funktionen

    [/autoit] [autoit][/autoit] [autoit]

    #region POOL-funktionen (verwaltung der beiden titel)
    Func _NextEntry()
    Local $iIndex, $sEntry
    $__IGNORENEXTTIME = GUICtrlRead($cb_ignorenexttime)
    $iIndex = _GUICtrlListBox_GetCurSel($hListBox)
    $sEntry = _GUICtrlListBox_GetText($hListBox, $iIndex)
    If $__IGNORENEXTTIME = 1 Then FileWriteLine($hIgnoreList, $aDupes[$iIndex][0] & " " & $aDupes[$iIndex][1])
    If $iIndex = 0 Then
    If _GUICtrlListBox_GetCount($hListBox) = 1 Then
    _GUICtrlListBox_DeleteString($hListBox, $iIndex)
    _ArrayDelete($aDupes, $iIndex)
    _MasterReset()
    EndIf
    _GUICtrlListBox_SetCurSel($hListBox, 1)
    _GUICtrlListBox_DeleteString($hListBox, $iIndex)
    _ArrayDelete($aDupes, $iIndex)
    _LoadTracks()
    ElseIf $iIndex = _GUICtrlListBox_GetCount($hListBox) - 1 Then
    _GUICtrlListBox_SetCurSel($hListBox, $iIndex - 1)
    _GUICtrlListBox_DeleteString($hListBox, $iIndex)
    _ArrayDelete($aDupes, $iIndex)
    _LoadTracks()
    Else
    _GUICtrlListBox_SetCurSel($hListBox, $iIndex + 1)
    _GUICtrlListBox_DeleteString($hListBox, $iIndex)
    _ArrayDelete($aDupes, $iIndex)
    _LoadTracks()
    EndIf
    GUICtrlSetState($cb_ignorenexttime, $GUI_UNCHECKED)
    GUICtrlSetData($l_CountPairs, GUICtrlRead($l_CountPairs) -1 )
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _OpenInExplorer()
    Local $iBClicked = @GUI_CtrlHandle
    If $iBClicked = GUICtrlGetHandle($b_open_left) Then
    ;~ Run ("explorer.exe " & GUICtrlRead($i_path_left) ,"")
    Run("explorer.exe /n,/e,/select," & _GUICtrlRichEdit_GetText($i_path_left))
    ElseIf $iBClicked = GUICtrlGetHandle($b_open_right) Then
    ;~ Run ("explorer.exe " & GUICtrlRead($i_path_right) ,"")
    Run("explorer.exe /n,/e,/select," & _GUICtrlRichEdit_GetText($i_path_right))
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MoveFile()
    Local $iBClicked = @GUI_CtrlHandle, $sFirstPath = "", $sSecondPath = "", $iQuest, $newPath = ""
    Local $sFile
    Local $oFSO
    _StopMusic()

    [/autoit] [autoit][/autoit] [autoit]

    If $iBClicked = GUICtrlGetHandle($b_move_left) Then ;-> verschieben links gedrückt
    $sFirstPath = _GUICtrlRichEdit_GetText($i_path_left) ;-> erster pfad: links
    $sSecondPath = _GUICtrlRichEdit_GetText($i_path_right) ;-> zweiter pfad: rechts
    ElseIf $iBClicked = GUICtrlGetHandle($b_move_right) Then ;-> verschieben rechts gedrückt
    $sFirstPath = _GUICtrlRichEdit_GetText($i_path_right)
    $sSecondPath = _GUICtrlRichEdit_GetText($i_path_left)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Dim $oFSO = ObjCreate("Scripting.FileSystemObject")
    $oFSO.DeleteFile($sSecondPath, True)

    [/autoit] [autoit][/autoit] [autoit]

    $oFSO.MoveFile($sFirstPath, _GetFilePath($sSecondPath), True)
    ;~ $oFSO.DeleteFile($sFirstPath, True)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;~ $iQuest = MsgBox(35, $sTitle, "Titel 1 zu " & $sSecondPath & " verschieben und Titel 2 löschen?")
    ;~ If $iQuest = 2 Then Return ;-> abbrechen
    ;~ If $iQuest = 6 Then ;-> ja
    ;~ Local $idel = FileDelete($sSecondPath)
    ;~ If $idel = 0 Then
    ;~ MsgBox(48, $sTitle, "Fehler beim Löschen von Titel 2:" & @CRLF & @CRLF & $sSecondPath)
    ;~ Return
    ;~ EndIf
    ;~ Local $imove = FileMove($sFirstPath, $sSecondPath, 1)
    ;~ If $imove = 0 Then
    ;~ MsgBox(48, $sTitle, "Fehler beim Verschieben von Titel 1:" & @CRLF & @CRLF & $sFirstPath)
    ;~ Return
    ;~ Else
    ;~ If $iBClicked = GUICtrlGetHandle($b_move_left) Then
    ;~ _GUICtrlRichEdit_WriteLine($e_infos_left,@CRLF & "Verschoben...", 0, "+bo", 0x000000)
    ;~ _GUICtrlRichEdit_SetText($i_path_left, "")
    ;~ GUICtrlSetState($b_move_left, $GUI_DISABLE)
    ;~ ElseIf $iBClicked = GUICtrlGetHandle($b_move_right) Then
    ;~ _GUICtrlRichEdit_WriteLine($e_infos_right,@CRLF & "Verschoben...", 0, "+bo", 0x000000)
    ;~ _GUICtrlRichEdit_SetText($i_path_right, "")
    ;~ GUICtrlSetState($b_move_right, $GUI_DISABLE)
    ;~ EndIf
    ;~ EndIf
    ;~ ElseIf $iQuest = 7 Then ;-> nein
    ;~ $newPath = FileSelectFolder("Zielordner auswählen", "::{00021400-0000-0000-C000-000000000046}", 4, $sFirstPath, $hGUI)
    ;~ If @error Then Return ;-> abbrechen
    ;~ If FileMove($sFirstPath, $newPath) = 0 Then
    ;~ MsgBox(48, $sTitle, "Fehler beim Verschieben von Titel 1" & @CRLF & @CRLF & $sFirstPath)
    ;~ Return
    ;~ Else
    ;~ If $iBClicked = GUICtrlGetHandle($b_move_left) Then
    ;~ _GUICtrlRichEdit_WriteLine($e_infos_left,@CRLF & "Verschoben...", 0, "+bo", 0x000000)
    ;~ _GUICtrlRichEdit_SetText($i_path_left, StringReplace($sFirstPath, _GetFilePath($sFirstPath), $newPath & ""))
    ;~ GUICtrlSetState($b_move_left, $GUI_DISABLE)
    ;~ ElseIf $iBClicked = GUICtrlGetHandle($b_move_right) Then
    ;~ _GUICtrlRichEdit_WriteLine($e_infos_right,@CRLF & "Verschoben...", 0, "+bo", 0x000000)
    ;~ _GUICtrlRichEdit_SetText($i_path_right, StringReplace($sFirstPath, _GetFilePath($sFirstPath), $newPath & ""))
    ;~ GUICtrlSetState($b_move_right, $GUI_DISABLE)
    ;~ EndIf
    ;~ EndIf
    ;~ EndIf

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _LoadTracks()
    Local $iCurSel, $sTrack[2], $sInfo = ""
    Local $iBitrate[2], $sLength[2], $hInfo[2], $sSize[2], $sFilename

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetState($b_playleft, $GUI_ENABLE)
    GUICtrlSetState($b_playright, $GUI_ENABLE)
    ;~ GUICtrlSetState($b_stopleft, $GUI_ENABLE)
    ;~ GUICtrlSetState($b_stopright, $GUI_ENABLE)
    GUICtrlSetState($b_rename_left, $GUI_ENABLE)
    GUICtrlSetState($b_rename_right, $GUI_ENABLE)
    GUICtrlSetState($b_delete_left, $GUI_ENABLE)
    GUICtrlSetState($b_delete_right, $GUI_ENABLE)
    GUICtrlSetState($b_deleteboth, $GUI_ENABLE)
    GUICtrlSetState($b_holdboth, $GUI_ENABLE)
    GUICtrlSetState($b_open_left, $GUI_ENABLE)
    GUICtrlSetState($b_open_right, $GUI_ENABLE)
    GUICtrlSetState($b_move_left, $GUI_ENABLE)
    GUICtrlSetState($b_move_right, $GUI_ENABLE)
    GUICtrlSetData($timeslide_left, 0)
    GUICtrlSetData($timeslide_right, 0)

    [/autoit] [autoit][/autoit] [autoit]

    _StopMusic()

    [/autoit] [autoit][/autoit] [autoit]

    $iCurSel = _GUICtrlListBox_GetCurSel($hListBox)
    $hInfo[0] = $e_infos_left
    $hInfo[1] = $e_infos_right
    _GUICtrlRichEdit_SetText($hInfo[0], "")
    _GUICtrlRichEdit_SetText($hInfo[1], "")
    _GUICtrlRichEdit_SetText($i_path_left, "")
    _GUICtrlRichEdit_SetText($i_path_right, "")
    If $iCurSel >= 0 Then
    $sTrack[0] = $aDupes[$iCurSel][0]
    $sTrack[1] = $aDupes[$iCurSel][1]
    $sFilename = _GetFileName($sTrack[0], 1)
    For $i = 0 To 1
    $sLength[$i] = _SoundFile_GetLength($sTrack[$i])
    $iBitrate[$i] = _SoundFile_GetBitrate($sTrack[$i])
    $sSize[$i] = Round((FileGetSize($sTrack[$i]) / 1048576), 3)
    Next

    [/autoit] [autoit][/autoit] [autoit]

    Local $iLength = _Compare_Length($sLength)
    _GUICtrlRichEdit_WriteLine($hInfo[0], $sFilename, 0, "+bo", $COLOR3)
    _GUICtrlRichEdit_WriteLine($hInfo[1], $sFilename, 0, "+bo", $COLOR3)
    If $iLength = 0 Then ;==> beide gleich lang
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Länge: " & $sLength[0] & " Min", 0, "-bo", $COLOR3)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Länge: " & $sLength[1] & " Min", 0, "-bo", $COLOR3)
    ElseIf $iLength = 1 Then ;==> erster track ist länger, somit grün, der andere rot..
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Länge: " & $sLength[0] & " Min", 0, "-bo", $COLOR4)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Länge: " & $sLength[1] & " Min", 0, "-bo", $COLOR8)
    ElseIf $iLength = -1 Then ;==> zweiter track ist länger, somit grün
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Länge: " & $sLength[0] & " Min", 0, "-bo", $COLOR8)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Länge: " & $sLength[1] & " Min", 0, "-bo", $COLOR4)
    EndIf
    If $iBitrate[0] = $iBitrate[1] Then
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Bitrate: " & $iBitrate[0] & " kBit/s", 0, "", $COLOR3)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Bitrate: " & $iBitrate[1] & " kBit/s", 0, "", $COLOR3)
    ElseIf $iBitrate[0] < $iBitrate[1] Then
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Bitrate: " & $iBitrate[0] & " kBit/s", 0, "", $COLOR8)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Bitrate: " & $iBitrate[1] & " kBit/s", 0, "", $COLOR4)
    ElseIf $iBitrate[0] > $iBitrate[1] Then
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Bitrate: " & $iBitrate[0] & " kBit/s", 0, "", $COLOR4)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Bitrate: " & $iBitrate[1] & " kBit/s", 0, "", $COLOR8)
    EndIf
    If $sSize[0] = $sSize[1] Then
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Grösse: " & $sSize[0] & " MByte", 0, "", $COLOR3)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Grösse: " & $sSize[1] & " MByte", 0, "", $COLOR3)
    ElseIf $sSize[0] < $sSize[1] Then
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Grösse: " & $sSize[0] & " MByte", 0, "", $COLOR8)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Grösse: " & $sSize[1] & " MByte", 0, "", $COLOR4)
    ElseIf $sSize[0] > $sSize[1] Then
    _GUICtrlRichEdit_WriteLine($hInfo[0], "Grösse: " & $sSize[0] & " MByte", 0, "", $COLOR4)
    _GUICtrlRichEdit_WriteLine($hInfo[1], "Grösse: " & $sSize[1] & " MByte", 0, "", $COLOR8)
    EndIf
    ;~ _GUICtrlRichEdit_WriteLine($hInfo[0], @CRLF & $sTrack[0], 0, "", 0x000000)
    ;~ _GUICtrlRichEdit_WriteLine($hInfo[1], @CRLF & $sTrack[1], 0, "", 0x000000)
    _Compare_Path($i_path_left, $sTrack[0], $i_path_right, $sTrack[1])
    ;~ GUICtrlSetData($i_path_left, $sTrack[0])
    ;~ GUICtrlSetData($i_path_right, $sTrack[1])
    GUICtrlSetData($l_SoundLenleft, $sLength[0])
    GUICtrlSetData($l_SoundLenright, $sLength[1])
    EndIf
    GUICtrlSetState($hListBox, $GUI_FOCUS)
    If $__AUTOPLAY = 1 Then
    _GUICtrlButton_Click($b_playleft)
    EndIf
    GUICtrlSetState($hListBox, $GUI_FOCUS)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _RenameFile()
    Local $iBClicked = @GUI_CtrlHandle
    Local $sNewName, $sOldName, $sSuffix
    Local $oFSO = ObjCreate("Scripting.FileSystemObject")
    Local $sFile
    If $iBClicked = GUICtrlGetHandle($b_rename_left) Then
    If FileExists(_GUICtrlRichEdit_GetText($i_path_left)) Then
    $sOldName = _GUICtrlRichEdit_GetText($i_path_left)
    $sNewName = InputBox($sTitle, "Neuen Dateinamen für Titel 1 eingeben...", _GetFileName($sOldName))
    If $sNewName <> "" Then
    If $iPlay <> -1 And $iPlayer = 0 Then _StopMusic()
    $sSuffix = StringRight($sOldName, 4)
    $sFile = $oFSO.GetFile($sOldName)
    $sNewName &= $sSuffix
    $sFile.Name = $sNewName
    _GUICtrlRichEdit_SetText($i_path_left, StringReplace($sOldName, _GetFileName($sOldName, True), $sNewName))
    _GUICtrlRichEdit_WriteLine($e_infos_left, "Datei umbenannt:", 0, "+bo", $COLOR4)
    _GUICtrlRichEdit_WriteLine($e_infos_left, $sNewName, 0, "", $COLOR3)
    EndIf
    EndIf
    ElseIf $iBClicked = GUICtrlGetHandle($b_rename_right) Then
    If FileExists(_GUICtrlRichEdit_GetText($i_path_right)) Then
    $sOldName = _GUICtrlRichEdit_GetText($i_path_right)
    $sNewName = InputBox($sTitle, "Neuen Dateinamen für Titel 2 eingeben...", _GetFileName($sOldName))
    If $sNewName <> "" Then
    If $iPlay <> -1 And $iPlayer = 1 Then _StopMusic()
    $sSuffix = StringRight($sOldName, 4)
    $sFile = $oFSO.GetFile($sOldName)
    $sNewName &= $sSuffix
    $sFile.Name = $sNewName
    _GUICtrlRichEdit_SetText($i_path_right, StringReplace($sOldName, _GetFileName($sOldName, True), $sNewName))
    _GUICtrlRichEdit_WriteLine($e_infos_right, "Datei umbenannt:", 0, "+bo", $COLOR4)
    _GUICtrlRichEdit_WriteLine($e_infos_right, $sNewName, 0, "", $COLOR3)
    EndIf
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _DeleteFile()
    Local $iBClicked = @GUI_CtrlHandle
    Local $iQuest, $sFile
    If $iBClicked = GUICtrlGetHandle($b_delete_left) Then
    $sFile = _GUICtrlRichEdit_GetText($i_path_left)
    If $__ASKDELSINGLE = 1 Then
    $iQuest = MsgBox(292, $sTitle, 'Datei "' & $sFile & '" wirklich löschen?')
    If $iQuest = 7 Then Return
    EndIf
    If $iPlayer = 0 Then _SoundStop($hSound)
    If FileDelete($sFile) Then
    _GUICtrlRichEdit_WriteLine($e_infos_left, "Gelöscht!", 0, "+bo", $COLOR8)
    Else
    _GUICtrlRichEdit_WriteLine($e_infos_left, "Löschen fehlgeschlagen!", 0, "+bo", $COLOR8)
    EndIf
    GUICtrlSetState($b_open_left, $GUI_DISABLE)
    GUICtrlSetState($b_deleteboth, $GUI_DISABLE)
    GUICtrlSetState($b_playleft, $GUI_DISABLE)
    GUICtrlSetState($b_stopleft, $GUI_DISABLE)
    GUICtrlSetState($b_rename_left, $GUI_DISABLE)
    GUICtrlSetState($b_delete_left, $GUI_DISABLE)

    [/autoit] [autoit][/autoit] [autoit]

    ElseIf $iBClicked = GUICtrlGetHandle($b_delete_right) Then
    $sFile = _GUICtrlRichEdit_GetText($i_path_right)
    If $__ASKDELSINGLE = 1 Then
    $iQuest = MsgBox(292, $sTitle, 'Datei "' & $sFile & '" wirklich löschen?')
    If $iQuest = 7 Then Return
    EndIf
    If $iPlayer = 1 Then _SoundStop($hSound)
    If FileDelete($sFile) Then
    _GUICtrlRichEdit_WriteLine($e_infos_right, "Gelöscht!", 0, "+bo", $COLOR8)
    Else
    _GUICtrlRichEdit_WriteLine($e_infos_right, "Löschen fehlgeschlagen!", 0, "+bo", $COLOR8)
    EndIf
    GUICtrlSetState($b_open_right, $GUI_DISABLE)
    GUICtrlSetState($b_deleteboth, $GUI_DISABLE)
    GUICtrlSetState($b_playright, $GUI_DISABLE)
    GUICtrlSetState($b_stopright, $GUI_DISABLE)
    GUICtrlSetState($b_rename_right, $GUI_DISABLE)
    GUICtrlSetState($b_delete_right, $GUI_DISABLE)

    [/autoit] [autoit][/autoit] [autoit]

    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _DeleteBoth()
    If $__ASKDELDOUBLE = 1 Then
    Local $iQuest = MsgBox(292, $sTitle, "Wirklich beide Files löschen?")
    If $iQuest = 7 Then Return
    EndIf
    _StopMusic()
    FileDelete(_GUICtrlRichEdit_GetText($i_path_left))
    FileDelete(_GUICtrlRichEdit_GetText($i_path_right))
    _NextEntry()
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _OpenPath()
    Local $path = IniRead($hSettings, "Settings", "LastPath", "")
    If FileExists($path) Then
    $path = FileSelectFolder("Pfad zur Musiksammlung öffnen...", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 4, StringLeft($path, 3), $hGUI) ;==> Dialog, um Ordner auszuwählen
    Else
    $path = FileSelectFolder("Pfad zur Musiksammlung öffnen...", "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 4, "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", $hGUI) ;==> Dialog, um Ordner auszuwählen
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If @error Then Return
    If FileExists($path) Then
    ;~ _ClearListBox()
    GUICtrlSetData($i_Path, $path) ;==> Wenn nicht abgebrochen wird, wird der Pfad in das Input-Feld geschrieben
    IniWrite($hSettings, "Settings", "LastPath", $path)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    #endregion POOL-Funktionen

    [/autoit] [autoit][/autoit] [autoit]

    #region Such- und Analysefunktionen

    [/autoit] [autoit][/autoit] [autoit]

    Func _Scan() ;===> Abgeänderte Version einer Funktion aus dem MP3-DoubleFinder von Oscar (http://www.autoit.de)
    Global $a_Titles[100000]
    ;==> Array, in welchen die gefundenen Titel geladen werden
    Local $s_Path = "", $tmp_path, $aPos = WinGetPos($hGUI)
    ;~ _ArrayDisplay($a_Titles)
    Dim $a_Files
    $s_Path = GUICtrlRead($i_Path) ;==> Pfad aus Input auslesen

    [/autoit] [autoit][/autoit] [autoit]

    If Not ($s_Path And FileExists($s_Path)) Then Return ;==> Wenn der Pfad nicht vorhanden ist, geschieht nichts
    If $iPlay = 0 And $iPause = 0 Then _StopMusic()
    _MasterReset()
    If $__ASKSCAN = 1 Then
    Local $closequest = MsgBox(292, $sTitle, "Ordner wirklich neu Scannen?")
    If $closequest = 7 Then Return
    EndIf
    _ReadIgnoreList()
    GUICtrlSetState($b_scan, $GUI_DISABLE) ;==> "Scannen"-Button deaktivieren
    GUICtrlSetState($b_openpath, $GUI_DISABLE)
    GUICtrlSetData($l_CountPairs, "0") ; Zähl-Labels zurücksetzen
    GUICtrlSetData($l_CountTracks, "0")
    _ClearListBox() ;==> Listbox leeren
    $iStop = False
    $i_PairCount = 0
    ;~ ToolTip($sMsg, $aPos[0] + 309, $aPos[1] + 400, $sTitle, 1, 3)
    ;~ _FileListToArrayRecursive($s_Path, $a_Files) ;==> Dateipfad nach audiodateien durchsuchen
    $a_Files = _RecursiveFileListToArray($s_Path, '(.+(\.mp3|\.wav|\.ogg|\.wma))', 1, 1)
    For $i = 1 To $a_Files[0] ;==> Dateinamen aus $a_Files auslesen -> wird in $a_Titles gespeichert
    $tmp_path = StringSplit($a_Files[$i], "")
    $a_Titles[$i] = $tmp_path[$tmp_path[0]]
    Next
    $a_Titles[0] = $i - 1
    ReDim $a_Titles[$i]
    ReDim $a_Files[$i]
    If $a_Files[0] = 0 Then ;==> wenn keine Musikdateien gefunden wurden
    _PlayDefaultSystemSound('SystemAsterisk') ; Danke, funkey!
    GUICtrlSetState($b_scan, $GUI_ENABLE)
    GUICtrlSetState($b_openpath, $GUI_ENABLE)
    ;~ ToolTip("")
    _GUICtrlListBox_AddString($hListBox, "Keine Musikdateien gefunden...")
    Return
    Else
    GUICtrlSetData($l_CountTracks, $a_Titles[0])
    ;~ ToolTip($sMsg, $aPos[0] + 420, $aPos[1] + 175, $sTitle, 1, 3)
    EndIf
    GUICtrlSetData($l_ActualDir, "")
    Local $oDictionary = ObjCreate('Scripting.Dictionary')
    Local $oID3 = ObjCreate('Scripting.Dictionary')
    Local $sFilename, $iFuzzyPar, $iFuzzySum
    Local $iFileSize, $aID3Tags, $tmp_filename

    [/autoit] [autoit][/autoit] [autoit]

    ReDim $aDupes[$a_Files[0]][2]
    Local $iTimer = TimerInit(), $sRuntime
    For $i = 1 To $a_Files[0]
    If $iStop Then ;==> wenn {ESC} gedrückt wurde, scan abbrechen
    _AbortScan()
    Return
    EndIf
    $sFilename = StringTrimRight(StringTrimLeft($a_Files[$i], StringInStr($a_Files[$i], '\', 1, -1)), 4)
    If $oDictionary.Exists($sFilename) Then
    $aDupes[$i_PairCount][0] = $oDictionary.Item($sFilename)
    $aDupes[$i_PairCount][1] = $a_Files[$i]
    $tmp_filename = StringSplit($a_Files[$i], "")
    If Not (_IsIgnored($aDupes[$i_PairCount][0]) And _IsIgnored($aDupes[$i_PairCount][1])) Then
    _GUICtrlListBox_AddString($hListBox, StringTrimRight($tmp_filename[$tmp_filename[0]], 4))
    $i_PairCount += 1
    GUICtrlSetData($l_CountPairs, $i_PairCount)
    EndIf
    ContinueLoop
    Else
    $oDictionary.Add($sFilename, $a_Files[$i])
    EndIf
    Next
    If $iStop = True Then Return
    $sRuntime = _NewTicksToTime(TimerDiff($iTimer))
    _PlayDefaultSystemSound('SystemExclamation') ; Danke, funkey!
    GUICtrlSetState($b_scan, $GUI_ENABLE)
    GUICtrlSetState($b_openpath, $GUI_ENABLE)
    If $i_PairCount = 0 Then
    _GUICtrlListBox_AddString($hListBox, "Keine doppelten Tracks gefunden...")
    ReDim $aDupes[1][2]
    Else
    ReDim $aDupes[$i_PairCount][2]
    EndIf
    ;~ _ArrayDisplay($aDupes)
    _GUICtrlListBox_SetCurSel($hListBox, 0)
    _LoadTracks()
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name: _RecursiveFileListToArray($sPath[, $sPattern][, $iFlag][, $iFormat][, $iRecursion][, $sDelim])
    ; Description:: gibt Verzeichnisse (rekursiv) und/oder Dateien 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.6.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, $sFile, $sReturn = ''
    If StringRight($sPath, 1) <> '\' Then $sPath &= '\'
    $hSearch = FileFindFirstFile($sPath & '*.*')
    If @error Or $hSearch = -1 Then Return SetError(1, 0, $sReturn)
    While True
    $sFile = FileFindNextFile($hSearch)
    If @error Then ExitLoop
    If @extended 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
    GUICtrlSetData($l_ActualDir, $sPath)
    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

    [/autoit] [autoit][/autoit] [autoit]

    Func _IsIgnored($sPath)
    If StringInStr($sIgnoreList, $sPath) = 0 Then
    Return 0
    Else
    Return 1
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _AbortScan()
    $iStop = True
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _SoundFile_GetBitrate($sPath)
    Local $answer

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; #FUNCTION#
    ;===============================================================================
    ;
    ; Name...........: _MStoTimeformat
    ; Description ...: Wandelt Millisekunden in das Format HH:MM:SS um
    ; Syntax.........: _MStoTimeformat($MStTf_MS)
    ; Parameters ....: $MStTf_MS - Zeit in Millisekunden (z.B vom TimerDiff() zurückgegeben
    ; Return values .: Success - Gibt die Millisekunden im Format HH:MM:SS zurück
    ; Failure - Returns 0 and Sets @Error:
    ; |1 - $MStTf_MS ist keine Zahl
    ; Author ........: TheLuBu ([email='LuBu@veytal.com'][/email])
    ; Modified.......:
    ; Remarks .......:
    ; Related .......:
    ; Link ..........;
    ;
    ;==========================================================================================
    Func _MStoTimeformat($MStTf_MS)
    ;~ If not IsNumber($MStTf_MS) Then Return SetError(1,0,0)
    Local $MStTf_vorzeichen = "", $MStTf_Endzeit, $MStTf_Stunden, $MStTf_Minuten, $MStTf_Sekunden, $MStTf_sret
    If $MStTf_MS < 0 Then
    $MStTf_MS = Abs($MStTf_MS)
    $MStTf_vorzeichen = "-"
    EndIf
    $MStTf_Endzeit = $MStTf_MS / 1000
    $MStTf_Stunden = $MStTf_Endzeit / 3600
    $MStTf_Stunden = Int($MStTf_Stunden)
    $MStTf_Minuten = (($MStTf_Endzeit / 60) - ($MStTf_Stunden * 60))
    $MStTf_Minuten = Int($MStTf_Minuten)
    $MStTf_Sekunden = ($MStTf_Endzeit - ($MStTf_Minuten * 60) - ($MStTf_Stunden * 3600))
    $MStTf_Sekunden = Int($MStTf_Sekunden)
    If $MStTf_Stunden < 10 Then $MStTf_Stunden = "0" & $MStTf_Stunden
    If $MStTf_Minuten < 10 Then $MStTf_Minuten = "0" & $MStTf_Minuten
    If $MStTf_Sekunden < 10 Then $MStTf_Sekunden = "0" & $MStTf_Sekunden
    $MStTf_sret = $MStTf_vorzeichen & $MStTf_Stunden & ":" & $MStTf_Minuten & ":" & $MStTf_Sekunden
    Return $MStTf_sret
    EndFunc ;==>MStoTimeformat

    [/autoit] [autoit][/autoit] [autoit]

    Func _Compare_Length(ByRef $aLength)
    If Not IsArray($aLength) Then Return
    Local $Seconds[2]
    For $i = 0 To 1
    $Seconds[$i] = (StringLeft($aLength[$i], 2) * 60) + StringRight($aLength[$i], 2)
    Next
    If $Seconds[0] = $Seconds[1] Then
    Return 0
    ElseIf $Seconds[0] < $Seconds[1] Then
    Return -1
    ElseIf $Seconds[0] > $Seconds[1] Then
    Return 1
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetFileName($sPath, $iSuffix = False)
    Local $aSplit = StringSplit($sPath, "")
    If Not @error Then
    If $iSuffix = False Then
    Return StringTrimRight($aSplit[$aSplit[0]], 4)
    Else
    Return $aSplit[$aSplit[0]]
    EndIf
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetFilePath($sPath)
    Local $aSplit = StringSplit($sPath, "")
    If Not @error Then Return StringReplace($sPath, $aSplit[$aSplit[0]], "")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    Func _SoundFile_GetLength($sPath)
    Local $sLen
    If FileExists($sPath) Then
    _SoundOpen($sPath)
    If @error Then SetError(1)
    $sLen = _SoundLength($sPath)
    _SoundClose($sPath)
    EndIf
    Return StringTrimLeft($sLen, 3) ; $Mins & ":" & $Secs
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;~ Func mciSendString($string)
    ;~ Local $ret
    ;~ $ret = DllCall("winmm.dll","int","mciSendString","str",$string,"str","","int",65534,"hwnd",0)
    ;~ If Not @error Then Return $ret[2]
    ;~ EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; #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

    [/autoit] [autoit][/autoit] [autoit]

    ; $iWait - Warten bis SoundPlay beendet? (0 = nein / 1 = ja)
    ; Return values .: -----
    ; Author ........: funkey (AutoIt.de)
    ; ===============================================================================================================================
    Func _PlayDefaultSystemSound($sSoundName, $iWait = 0) ; funkey
    Local $sKey = 'HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default'
    If $sSoundName = 'EmptyRecycleBin' Or $sSoundName = 'Navigating' Then $sKey = 'HKEY_CURRENT_USER\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

    [/autoit] [autoit][/autoit] [autoit]

    #endregion Suchfunktionen

    [/autoit] [autoit][/autoit] [autoit]

    #region Settings-Funktionen

    [/autoit] [autoit][/autoit] [autoit]

    Func _ApplyColors()
    Local $iBClicked = @GUI_CtrlId
    Local $aColors[8]

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To 7
    $aColors[$i] = GUICtrlGetBkColor($aControls[$i][1])
    Next
    $COLOR1 = "0x" & StringTrimLeft(Hex($aColors[0]), 2)
    $COLOR2 = "0x" & StringTrimLeft(Hex($aColors[1]), 2)
    $COLOR3 = "0x" & StringTrimLeft(Hex($aColors[2]), 2)
    $COLOR4 = "0x" & StringTrimLeft(Hex($aColors[3]), 2)
    $COLOR5 = "0x" & StringTrimLeft(Hex($aColors[4]), 2)
    $COLOR6 = "0x" & StringTrimLeft(Hex($aColors[5]), 2)
    $COLOR7 = "0x" & StringTrimLeft(Hex($aColors[6]), 2)
    $COLOR8 = "0x" & StringTrimLeft(Hex($aColors[7]), 2)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetBkColor($COLOR1, $hGUI) ;==> GUI Hintergrundfarbe COLOR1
    GUISetBkColor($COLOR1, $hGui_Settings)
    GUISetBkColor($COLOR1, $hGui_About)
    GUISetBkColor($COLOR1, $hGui_Color)
    GUISetBkColor($COLOR1, $hGUI_Shorcut)
    GUICtrlSetBkColor($timeslide_left, $COLOR1)
    GUICtrlSetBkColor($timeslide_right, $COLOR1) ;==< GUI Hintergrundfarbe COLOR1

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetDefBkColor($COLOR2, $hGUI) ;==> GUI Sekundärfarbe COLOR2 (farbe der Edits und Inputs)
    GUICtrlSetDefBkColor($COLOR2, $hGui_Settings)
    GUICtrlSetDefBkColor($COLOR2, $hGui_About)
    GUICtrlSetDefBkColor($COLOR2, $hGui_Color)
    GUICtrlSetDefBkColor($COLOR2, $hGUI_Shorcut) ;==< GUI Sekundärfarbe COLOR2

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetDefColor($COLOR3, $hGui) ;==> GUI Schriftfarbe
    GUICtrlSetDefColor($COLOR3, $hGui_Settings)
    GUICtrlSetDefColor($COLOR3, $hGui_About)
    GUICtrlSetDefColor($COLOR3, $hGui_Color)
    GUICtrlSetDefColor($COLOR3, $hGUI_Shorcut) ;==> GUI Schriftfarbe

    [/autoit] [autoit][/autoit] [autoit]

    IniWrite($hSettings, "Settings", "Color1", $COLOR1)
    IniWrite($hSettings, "Settings", "Color2", $COLOR2)
    IniWrite($hSettings, "Settings", "Color3", $COLOR3)
    IniWrite($hSettings, "Settings", "Color4", $COLOR4)
    IniWrite($hSettings, "Settings", "Color5", $COLOR5)
    IniWrite($hSettings, "Settings", "Color6", $COLOR6)
    IniWrite($hSettings, "Settings", "Color7", $COLOR7)
    IniWrite($hSettings, "Settings", "Color8", $COLOR8)
    If $iBClicked = $b_colors_ok Then _ToggleColor()
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ReadColors()
    $aControls[0][0] = $b_pick1
    $aControls[0][1] = $l_Color1
    $aControls[1][0] = $b_pick2
    $aControls[1][1] = $l_Color2
    $aControls[2][0] = $b_pick3
    $aControls[2][1] = $l_Color3
    $aControls[3][0] = $b_pick4
    $aControls[3][1] = $l_Color4
    $aControls[4][0] = $b_pick5
    $aControls[4][1] = $l_Color5
    $aControls[5][0] = $b_pick6
    $aControls[5][1] = $l_Color6
    $aControls[6][0] = $b_pick7
    $aControls[6][1] = $l_Color7
    $aControls[7][0] = $b_pick8
    $aControls[7][1] = $l_Color8
    $COLOR1 = IniRead($hSettings, "Settings", "Color1", 0xBDBDBD)
    $COLOR2 = IniRead($hSettings, "Settings", "Color2", 0xDCDCDC)
    $COLOR3 = IniRead($hSettings, "Settings", "Color3", 0x000000)
    $COLOR4 = IniRead($hSettings, "Settings", "Color4", 0x228B22)
    $COLOR5 = IniRead($hSettings, "Settings", "Color5", 0xFF8C00)
    $COLOR6 = IniRead($hSettings, "Settings", "Color6", 0x0080FF)
    $COLOR7 = IniRead($hSettings, "Settings", "Color7", 0x009900)
    $COLOR8 = IniRead($hSettings, "Settings", "Color8", 0xEE2C2C)
    GUICtrlSetBkColor($l_Color1, $COLOR1)
    GUICtrlSetBkColor($l_Color2, $COLOR2)
    GUICtrlSetBkColor($l_Color3, $COLOR3)
    GUICtrlSetBkColor($l_Color4, $COLOR4)
    GUICtrlSetBkColor($l_Color5, $COLOR5)
    GUICtrlSetBkColor($l_Color6, $COLOR6)
    GUICtrlSetBkColor($l_Color7, $COLOR7)
    GUICtrlSetBkColor($l_Color8, $COLOR8)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetColor()
    Local $iBClicked = @GUI_CtrlId
    Local $Data, $sSearch
    $sSearch = _ArraySearch($aControls, $iBClicked)
    $Color = GUICtrlGetBkColor($aControls[$sSearch][1])
    $Data = _ColorChooserDialog($Color, $hGui_Color)
    If $Data > -1 Then
    $sSearch = _ArraySearch($aControls, $iBClicked)
    ;~ If $sSearch = -1 Then Return
    GUICtrlSetBkColor($aControls[$sSearch][1], $Data)
    $Color = $Data
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ResetSettings()
    Local $iResetQuest = MsgBox(292, $sTitle, "Einstellungen wirklich zurücksetzen?")
    If $iResetQuest = 7 Then Return
    FileClose($hSettings)
    FileDelete($hSettings)
    Local $iDelIgnoreList = MsgBox(292, $sTitle, 'Die "Nächstes Mal Ignorieren"-Liste auch löschen"')
    If $iDelIgnoreList = 6 Then
    FileClose($hIgnoreList)
    FileDelete($hIgnoreList)
    EndIf
    _ResourceSaveToFile("settings.ini", "DEFSETTINGS")
    Sleep(300)
    _LoadSettings()
    _ApplySettings()
    $hIgnoreList = "ignorelist.txt"
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ApplySettings()
    $__ASKCLOSE = IniRead($hSettings, "Settings", "AskClose", 1)
    $__ASKSCAN = IniRead($hSettings, "Settings", "AskScan", 1)
    $__ASKDELSINGLE = IniRead($hSettings, "Settings", "AskDel", 1)
    $__ASKDELDOUBLE = IniRead($hSettings, "Settings", "AskDeld", 1)
    $__AUTOPLAY = IniRead($hSettings, "Settings", "AutoPlay", 1)
    $__SKIPTIME = IniRead($hSettings, "Settings", "SkipTime", 10)

    [/autoit] [autoit][/autoit] [autoit]

    $aFunctions[0] = $b_playleft
    $aFunctions[1] = $b_rename_left
    $aFunctions[2] = $b_move_left
    $aFunctions[3] = $b_delete_left
    $aFunctions[4] = $b_open_left
    $aFunctions[5] = $b_playright
    $aFunctions[6] = $b_rename_right
    $aFunctions[7] = $b_move_right
    $aFunctions[8] = $b_delete_right
    $aFunctions[9] = $b_open_right
    $aFunctions[10] = $d_skipforward
    $aFunctions[11] = $d_skipback
    $aFunctions[12] = $b_stopleft
    $aFunctions[13] = $b_holdboth
    $aFunctions[14] = $d_ignorenexttime
    $aFunctions[15] = $b_deleteboth
    $aFunctions[16] = $b_openpath
    $aFunctions[17] = $b_scan
    $aFunctions[18] = $d_stopsearch
    $aFunctions[19] = $d_volumeup
    $aFunctions[20] = $d_volumedown
    $aFunctions[21] = $d_settings
    $aFunctions[22] = $hOptionsMenu_Color
    $aFunctions[23] = $hFileMenu_new

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To 23
    Local $sSection = "Shortcut" & $i + 1
    $aShortCuts[$i] = String(IniRead($hSettings, $sSection, "Shortcut", "Fehler"))
    Next

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 0 To 23
    $AccelKeys[$i][0] = $aShortCuts[$i]
    $AccelKeys[$i][1] = $aFunctions[$i]
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ;~ _ArrayDisplay($AccelKeys)
    Local $test = GUISetAccelerators($AccelKeys, $hGUI)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _LoadSettings()
    Local $a_Shortcuts[24][2], $sShortcut
    For $i = 1 To 24
    $sShortcut = "Shortcut" & $i
    $a_Shortcuts[$i - 1][0] = IniRead($hSettings, $sShortcut, "Name", "Fehler")
    $a_Shortcuts[$i - 1][1] = IniRead($hSettings, $sShortcut, "Shortcut", "Fehler")
    Next
    ;~ _ArrayDisplay($a_Shortcuts)
    _GUICtrlListView_DeleteAllItems($h_ListViewSettings)
    _GUICtrlListView_AddArray($h_ListViewSettings, $a_Shortcuts)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetState($cb_ask_scan, IniRead($hSettings, "Settings", "AskScan", $GUI_CHECKED))
    GUICtrlSetState($cb_ask_delsingle, IniRead($hSettings, "Settings", "AskDel", $GUI_CHECKED))
    GUICtrlSetState($cb_ask_deldouble, IniRead($hSettings, "Settings", "AskDeld", $GUI_CHECKED))
    GUICtrlSetState($cb_ask_close, IniRead($hSettings, "Settings", "AskClose", $GUI_CHECKED))
    GUICtrlSetState($cb_player_autoplay, IniRead($hSettings, "Settings", "AutoPlay", $GUI_UNCHECKED))
    GUICtrlSetData($i_skiptime, IniRead($hSettings, "Settings", "SkipTime", 10))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _GetShortCut($iIndex)
    Local $iKeyPressed, $iSearch
    GUISetState(@SW_DISABLE, $hGui_Settings)
    GUISetState(@SW_SHOW, $hGUI_Shorcut)
    Sleep(100) ;==> damit die Controls im GUI angezeigt werden
    $iKeyPressed = _GetKeyInput(3000, 2)
    If @error Then ;==> keine taste wurde gedrückt
    GUISetState(@SW_ENABLE, $hGui_Settings)
    GUISetState(@SW_HIDE, $hGUI_Shorcut)
    Return
    EndIf
    $iSearch = _ArraySearch($aShortCuts, $iKeyPressed)

    [/autoit] [autoit][/autoit] [autoit]

    If $iSearch >= 0 Then
    GUISetState(@SW_ENABLE, $hGui_Settings)
    GUISetState(@SW_HIDE, $hGUI_Shorcut)
    Return
    Else
    _GUICtrlListView_SetItemText($h_ListViewSettings, $iIndex, $iKeyPressed, 1)
    $aShortcuts[$iIndex] = $iKeyPressed
    GUISetState(@SW_ENABLE, $hGui_Settings)
    GUISetState(@SW_HIDE, $hGUI_Shorcut)
    ;~ _ArrayDisplay($aShortCuts)
    Return
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _SaveSettings()
    Local $iSkipTime, $sShortCut, $sSection
    $iSkipTime = GUICtrlRead($i_skiptime)

    [/autoit] [autoit][/autoit] [autoit]

    IniWrite($hSettings, "Settings", "AskScan", GUICtrlRead($cb_ask_scan))
    IniWrite($hSettings, "Settings", "AskDel", GUICtrlRead($cb_ask_delsingle))
    IniWrite($hSettings, "Settings", "AskDeld", GUICtrlRead($cb_ask_deldouble))
    IniWrite($hSettings, "Settings", "AskClose", GUICtrlRead($cb_ask_close))
    IniWrite($hSettings, "Settings", "AutoPlay", GUICtrlRead($cb_player_autoplay))

    [/autoit] [autoit][/autoit] [autoit]

    If $iSkipTime > 2 And $iSkipTime < 121 Then
    IniWrite($hSettings, "Settings", "SkipTime", $iSkipTime)
    Else
    IniWrite($hSettings, "Settings", "SkipTime", 10)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To 24
    $sShortCut = _GUICtrlListView_GetItemText($h_ListViewSettings, $i -1, 1)
    $sSection = "Shortcut" & $i
    IniWrite($hSettings, $sSection, "Shortcut", $sShortCut)
    Next
    _ToggleSettings()
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; Autor: Faweyr
    ; Function: GetKeyInput($sTime,$sBack)
    ; Parameter: $sTime = Time to wait and check for pressed Keys
    ; $sBack = the kind of Result
    ; 0 = Array[3] = ["_ispressed"-Code , "Send"-Code , Name of Key]
    ; 1 = "_ispressed"-Code
    ; 2 = "Send"-Code
    ; 3 = Name of Key
    ; Includes: <Misc.au3>
    func _GetKeyInput($sTime = 5000,$sBack = 0)
    Local $sTimer = TimerInit()
    Local $sDll = DllOpen("user32.dll")
    Local $sList[111][3] = [ [08,"{BACKSPACE}","Backspace"], [09,"{TAB}","Tab"], [0&"D","{ENTER}","Enter"], ["A"&0,"{LSHIFT}","Left Shift"], ["A"&1,"{RSHIFT}","Right Shift"], _
    [13,"{Pause}","Pause"], [14,"{CAPSLOCK}","Caps Lock"], [1&"B","{ESC}","Esc"], [20,"{SPACE}","Spacebar"], [21,"{PGUP}","Page Up"], [22,"{PGDN}","Page Down"], [23,"{End}","End"], _
    [24,"{Home}","Home"], [25,"{Left}","Left Arrow"], [26,"{UP}","Up Arrow"], [27,"{Right}","Right Arrow"], [28,"{Down}","Down Arrow"], [12,"{ALT}","Alt"], [5&"C","{RWIN}","Right Windows"], _
    [2&"C","{PRINTSCREEN}","Print Screen"], [2&"D","{INS}","Ins"], [2&"E","{DELETE}","Del"], [30,0,"0"], [31,1,"1"], [32,2,"2"], _
    [33,3,"3"], [34,4,"4"], [35,5,"5"], [36,6,"6"], [37,7,"7"], [38,8,"8"], [39,9,"9"], _
    [41,"a","A"], [42,"b","B"], [43,"c","C"], [44,"d","D"], [45,"e","E"], [46,"f","F"], [47,"g","G"], _
    [48,"h","H"], [49,"i","I"], [4&"A","j","J"], [4&"B","k","K"], [4&"C","l","L"], [4&"D","m","M"], [4&"E","n","N"], _
    [4&"F","o","O"], [50,"p","P"], [51,"q","Q"], [52,"r","R"], [53,"s","S"], [54,"t","T"], [55,"u","U"], _
    [56,"v","V"], [57,"w","W"], [58,"x","X"], [59,"y","Y"], [5&"A","z","Z"], [60,"{NUMPAD0}","Keypad 0"], [61,"{NUMPAD1}","Keypad 1"], _
    [62,"{NUMPAD2}","Keypad 2"],[63,"{NUMPAD3}","Keypad 3"], [64,"{NUMPAD4}","Keypad 4"], [65,"{NUMPAD5}","Keypad 5"], [66,"{NUMPAD6}","Keypad 6"], [67,"{NUMPAD7}","Keypad 7"], [68,"{NUMPAD8}","Keypad 8"], _
    [69,"{NUMPAD9}","Keypad 9"],[6&"A","{NUMPADMULT}","Multiply"], [6&"B","{NUMPADADD}","Add"], [6&"C","{NUMPADENTER}","Separator"],[6&"D","{NUMPADSUB}","Subtract"], [6&"E","{NUMPADDOT}","Decimal"], [6&"F","{NUMPADDIV}","Divide"], _
    [70,"{F1}","F1"], [71,"{F2}","F2"], [72,"{F3}","F3"], [73,"{F4}","F4"], [74,"{F5}","F5"], [75,"{F6}","F6"], [76,"{F8}","F7"], _
    [77,"{F8}","F8"], [78,"{F9}","F9"], [79,"{F10}","F10"], [7&"A","{F11}","F11"], [7&"B","{F12}","F12"], [90,"{NUMLOCK}","Num Lock"], [91,"{SCROLLLOCK}","Scroll Lock"], _
    ["A"&2,"{LCTRL}","Left Control"], ["A"&3,"{RCTRL}","Right Control"], ["A"&4,"{LALT}","Left Menu"], ["A"&5,"{RALT}","Right Menu"], [5&"B","{LWIN}","Left Windows"] ]

    [/autoit] [autoit][/autoit] [autoit]

    do
    for $i = 0 to UBound($sList)-1 step 1
    If _IsPressed($sList[$i][0], $sDll) then
    DllClose($sDll)
    If $sBack <> 0 then
    Return $sList[$i][$sBack-1]
    else
    Local $sResult[3] = [$sList[$i][0],$sList[$i][1],$sList[$i][2]]
    Return $sResult
    endif
    endif
    Next
    GUICtrlSetData($l_time, Ceiling(Int($sTime - TimerDiff($sTimer))/1000))
    until $sTime <= TimerDiff($sTimer)
    DllClose($sDll)
    SetError(1)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ReadIgnoreList()
    Local $aIgnoreList
    _FileReadToArray($hIgnoreList, $aIgnoreList)
    $sIgnoreList = _ArrayToString($aIgnoreList)
    EndFunc
    #endregion Settings-Funktionen

    [/autoit] [autoit][/autoit] [autoit]

    #region Sonstige Funktionen

    [/autoit] [autoit][/autoit] [autoit]

    Func _SmallerNumber($sA, $sB)
    If $sA > $sB Then
    Return $sB
    Else
    Return $sA
    EndIf
    EndFunc
    #endregion Sonstige Funktionen

    [/autoit] [autoit][/autoit] [autoit]

    #region WM-Funktionen
    Func _WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iCode, $tNMHDR, $hWndListView

    [/autoit] [autoit][/autoit] [autoit]

    $hWndListView = $h_ListViewSettings
    If Not IsHWnd($h_ListViewSettings) Then $hWndListView = GUICtrlGetHandle($h_ListViewSettings)

    [/autoit] [autoit][/autoit] [autoit]

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")

    [/autoit] [autoit][/autoit] [autoit]

    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode

    [/autoit] [autoit][/autoit] [autoit]

    Case $NM_DBLCLK; Eine Spalte wurde angeklickt
    Local $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
    Local $tIndex = DllStructGetData($tInfo, "Item")
    _GetShortCut($tIndex)
    EndSwitch
    EndSwitch
    Return $__LISTVIEWCONSTANT_GUI_RUNDEFMSG
    EndFunc ;==>_WM_NOTIFY

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
    If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Niederwertiges Wort (WORD)
    $iCode = BitShift($iwParam, 16) ; Höherwertiges Wort (WORD)
    Switch $hWndFrom
    Case $hListBox, $hWndListBox
    Switch $iCode
    Case $LBN_DBLCLK ; Wird gesendet, wenn der Benutzer einen Doppelklick auf einen String in einer ListBox ausführt
    _LoadTracks()
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND
    #endregion WM-Funktionen

    [/autoit]

    settings.ini

    Spoiler anzeigen

    [Settings]
    LastPath=M:\20_AutoIt\10_Edit\10_DoubleKill\TEST
    Volume=9
    SkipTime=50
    AutoPlay=4
    AskScan=4
    AskDel=1
    AskDeld=1
    AskClose=4
    Color1=0xBDBDBD
    Color2=0xDEDEDE
    Color3=0x000000
    Color4=0x228B22
    Color5=0xFF9900
    Color6=0x0080FF
    Color7=0x009900
    Color8=0xFF0000
    [Shortcut1]
    Name=Titel 1 abspielen/pausieren
    Shortcut=2
    [Shortcut2]
    Name=Titel 1 umbenennen
    Shortcut=q
    [Shortcut3]
    Name=Titel 1 verschieben
    Shortcut=y
    [Shortcut4]
    Name=Titel 1 löschen
    Shortcut=s
    [Shortcut5]
    Name=Titel 1 im Explorer öffnen
    Shortcut=a
    [Shortcut6]
    Name=Titel 2 abspielen/pausieren
    Shortcut=3
    [Shortcut7]
    Name=Titel 2 umbenennen
    Shortcut=r
    [Shortcut8]
    Name=Titel 2 verschieben
    Shortcut=v
    [Shortcut9]
    Name=Titel 2 löschen
    Shortcut=d
    [Shortcut10]
    Name=Titel 2 im Explorer öffnen
    Shortcut=f
    [Shortcut11]
    Name=Vorwärts spulen
    Shortcut=e
    [Shortcut12]
    Name=Rückwärts spulen
    Shortcut=w
    [Shortcut13]
    Name=Stop
    Shortcut=x
    [Shortcut14]
    Name=Nächster Eintrag
    Shortcut=4
    [Shortcut15]
    Name=Paar nächstes mal Ignorieren
    Shortcut=5
    [Shortcut16]
    Name=Beide löschen
    Shortcut=1
    [Shortcut17]
    Name=Musiksammlung öffnen
    Shortcut={F4}
    [Shortcut18]
    Name=Scannen
    Shortcut={F5}
    [Shortcut19]
    Name=Scan abbrechen
    Shortcut={ESC}
    [Shortcut20]
    Name=Lautstärke erhöhen
    Shortcut={UP}
    [Shortcut21]
    Name=Lautstärke verringern
    Shortcut={Down}
    [Shortcut22]
    Name=Einstellungen öffnen / schliessen
    Shortcut={F9}
    [Shortcut23]
    Name=Farb-Einstellungen öffnen / schliessen
    Shortcut={F10}
    [Shortcut24]
    Name=Neue Instanz
    Shortcut={F2}

  • Automatisierte Installation (fortgeschritten)

    • TheSystemAlien
    • 2. November 2013 um 19:12

    Standard-Programme? Domäne? Erweiterte automatische Installation? Klingt für mich verdächtig nach WDS-Server. Wäre es damit nicht viel einfacher zu realisieren? Kommt natürlich drauf an, wie viele Clients ihr aufsetzten müsst. Aber wenn du dir die Mühe machst, ein Script zu schreiben, denke ich, dass es nicht wenige sind. Ausserdem ist ein WDS in null komma nix installiert (Der DC ist ja eh schon vorhanden). Bloss die Images brauchen ihre Zeit..
    Ansonsten kann ich zum Problem selbst leider nicht helfen, sorry. War bloss grad so ein Gedanke von mir..

  • _ArrayDisplay() stürzt ab

    • TheSystemAlien
    • 25. Oktober 2013 um 21:18

    Hat sich gerade erledigt. Bin über das Script von Oscar gestossen. Ist prinzipiell genau das, was ich wollte :)

    Danke trotzdem

  • _ArrayDisplay() stürzt ab

    • TheSystemAlien
    • 25. Oktober 2013 um 19:51

    Sorry.. Die hab ich vergessen...

    Dateien

    Include.zip 3,69 kB – 202 Downloads
  • _ArrayDisplay() stürzt ab

    • TheSystemAlien
    • 25. Oktober 2013 um 19:23

    Ganz vergessen...

    Vielen Dank im Voraus für Eure Bemühungen!

    Und gottseidank ist die Seite wieder Online, hab fast ein Schock bekommen..

    :rock:

  • _ArrayDisplay() stürzt ab

    • TheSystemAlien
    • 25. Oktober 2013 um 19:19

    Moin Leute

    Ich hab mich seit Monaten wieder mal dazu motivieren können, ein Script zu schreiben. Deshalb sind meine Kentnisse ein bisschen eingefrohren. :(
    Es geht im wesentlichen darum, einen Ordner rekursiv nach Audiodateien zu untersuchen und doppelt vorhandene Lieder zu finden, um zu benennen, zu löschen usw..

    Bis jetzt wird der Ordner erfolgreich durchsucht und alle Dateipfäde in einem Array gespeichert (in der jetzigen Version in einem .txt, das später eingelesen wird).
    Doppelt Vorhandene Lieder werden erfolgreich ermittelt und in der ListBox dargestellt, per Doppelklick sollen nun die beiden Dateien geladen werden, so dass man sie vergleichen kann.
    Da erscheint das Problem. Der Doppelklick wird per WM_COMMAND ermittelt, welcher die Funktion _LoadTracks() auslöst. Egal wie ich in dieser Funktion den vorherigen Array auslesen will (ob per Global oder durch _FileReadToArray), es funktioniert nicht und _ArrayDisplay() stürzt ab.

    _ArraySearch sagt bloss, dass der gesuchte String nicht gefunden wurde.
    MsgBox(0, "", $array[x]) zeigt den richtigen Inhalt an.

    Weiss jemand, was genau ich falsch gemacht habe?

    Die entsprechenden Zeilen sind markiert.
    Ohne vorhandene Audiodateien stürzt das Script noch ab. Mindenstens eine muss doppelt vorhanden sein (in Unterordner).

    Spoiler anzeigen
    [autoit]


    #AutoIt3Wrapper_Res_File_Add=searching.gif, rt_rcdata, ANI_GIF_1

    [/autoit] [autoit][/autoit] [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <Array.au3>
    #include <File.au3>
    #include <GuiListBox.au3>
    #include <SliderConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <IE.au3>
    #include <GDIPlus.au3>
    #include <Misc.au3>
    #include <WinAPI.au3>
    #include <Timers.au3>
    #include "resources.au3"
    #include "_FileListToArrayrecursive.au3"
    Opt("GuiOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $hGUI = GUICreate("Doppelte Tracks Finden", 618, 500, 193, 127)
    $Group1 = GUICtrlCreateGroup("Titel 1", 8, 16, 257, 225)
    $l_filename_left = GUICtrlCreateLabel("Dateiname:", 16, 40, 58, 17)
    $l_length_left = GUICtrlCreateLabel("Länge:", 16, 64, 37, 17)
    $l_filesize_left = GUICtrlCreateLabel("Dateigrösse:", 16, 88, 63, 17)
    $l_filepath_left = GUICtrlCreateLabel("Dateipfad:", 16, 136, 53, 17)
    $e_filepath_left = GUICtrlCreateEdit("", 16, 160, 241, 73, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
    GUICtrlSetData(-1, "e_filepath_left")
    $timeslide_left = GUICtrlCreateSlider(16, 112, 162, 21)
    $b_playleft = GUICtrlCreatePic("playpause.jpg" , 233, 32, 25, 25)
    $b_stopleft = GUICtrlCreatePic("stop.jpg", 233, 64, 25, 25)
    $b_rename = GUICtrlCreateButton("Umbenennen", 188, 96, 71, 25)
    $b_delete_left = GUICtrlCreateButton("Löschen", 208, 128, 51, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Group2 = GUICtrlCreateGroup("Titel 2", 272, 16, 257, 225)
    $b_stopright = GUICtrlCreatePic("Umbenennen", 472, 96, 51, 25)
    $l_filename_right = GUICtrlCreateLabel("Dateiname:", 280, 40, 58, 17)
    $l_length_right = GUICtrlCreateLabel("Länge:", 280, 64, 37, 17)
    $l_filesize_right = GUICtrlCreateLabel("Dateigrösse:", 280, 88, 63, 17)
    $e_filepath_right = GUICtrlCreateEdit("", 280, 160, 241, 73, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
    GUICtrlSetData(-1, "e_filepath_right")
    $l_filepath_right = GUICtrlCreateLabel("Dateipfad:", 280, 136, 53, 17)
    $timeslide_right = GUICtrlCreateSlider(280, 112, 162, 21)
    $b_delete_right = GUICtrlCreateButton("Löschen", 472, 128, 51, 25)
    $b_delete_right = GUICtrlCreateButton("Umbenennen", 452, 96, 71, 25)
    $b_playright = GUICtrlCreatePic("playpause.jpg" , 497, 32, 25, 25)
    $b_stopright = GUICtrlCreatePic("stop.jpg", 497, 64, 25, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Group3 = GUICtrlCreateGroup("Gefundene Tracks", 8, 250, 600, 200)
    ;~ $hListBox = GUICtrlCreateListView("", 16, 268, 580, 170)
    $hListBox = _GUICtrlListBox_Create($hGUI, "", 16, 268, 580, 170)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $b_holdboth = GUICtrlCreateButton("Beide behalten", 536, 216, 75, 25)
    $b_deleteboth = GUICtrlCreateButton("Beide löschen", 536, 184, 75, 25)

    [/autoit] [autoit][/autoit] [autoit]

    $IMG_Ctrl = GUICtrlCreateLabel("", 536, 23, 10, 10) ; For Drawing
    $pleasewait = GUICtrlCreateLabel("Bitte warten... Sammlung wird analysiert...", 536, 75, 100, 41)
    GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $hGUI)

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    [/autoit] [autoit][/autoit] [autoit]

    Global $GIF_TimerID, $hImage, $IMG_Ctrl, $GFC, $GFDC, $pDimensionIDs, $tDL
    Global $Pause, $i = 0

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $a_Titles[100000]
    Global $a_Combos ;==> Array, in dem die Kombinationen gespeichert sind
    Global $S_PATH = "X:\90_AutoIt\Doppelte Titel\TEST"
    Global $filelist = @ScriptDir & "\filelist.txt"

    [/autoit] [autoit][/autoit] [autoit]

    GifInit()
    ; Start Animation: instead of using the time delays between frames given from GIF we use 100ms for simplicity
    _Timer_SetTimer($hGUI, 100, "_Draw_Timer")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _SearchTitles($S_PATH)

    [/autoit] [autoit][/autoit] [autoit]

    While 1

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(100)

    [/autoit] [autoit][/autoit] [autoit]

    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _SearchTitles($s_Path)
    Global $filearray
    _FileListToArrayRecursive($s_Path, $filearray)
    For $i = 1 To $filearray[0]
    $tmp_path = StringSplit($filearray[$i], "")
    $a_Titles[$i] = $tmp_path[$tmp_path[0]]
    Next
    $a_Titles[0] = $i - 1
    ReDim $a_Titles[$i]
    ReDim $filearray[$i]
    _ArrayDelete($a_Titles, 0)
    ;~ _ArrayDisplay($a_Titles)

    [/autoit] [autoit][/autoit] [autoit]

    $a_Combos = __ArrayUnique($a_Titles)

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To UBound($a_Combos) - 1
    _GUICtrlListBox_AddString($hListBox, StringTrimRight($a_Combos[$i], 4))
    Next
    GUICtrlSetState($IMG_Ctrl, $GUI_HIDE)
    GUICtrlSetState($pleasewait, $GUI_HIDE)
    ;~ _ArrayDisplay($filearray, "filearray")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _FileWriteFromArray($filelist, $filearray)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;=====> Hier funktionierts
    _arraydisplay($filearray)
    ;=======> noch...

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _LoadTracks()
    Local $tmp_filelist
    $tmp_index = _GUICtrlListBox_GetCurSel($hListBox)
    $tmp_title = _GUICtrlListBox_GetText($hListBox, $tmp_index)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _ArrayDisplay($filearray)
    ;====> hier funktionierts nicht mehr.. selbst wenn der array zuvor neu aus der datei $filelist ausgelesen wird..

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func __ArrayUnique($aArray, $iDimension = 1, $iBase = 0, $iCase = 0, $vDelim = "|")
    Local $iUboundDim
    ;$aArray used to be ByRef, but litlmike altered it to allow for the choosing of 1 Array Dimension, without altering the original array
    If $vDelim = "|" Then $vDelim = Chr(01) ; by SmOke_N, modified by litlmike
    If Not IsArray($aArray) Then Return SetError(1, 0, 0) ;Check to see if it is valid array

    [/autoit] [autoit][/autoit] [autoit]

    ;Checks that the given Dimension is Valid
    If Not $iDimension > 0 Then
    Return SetError(3, 0, 0) ;Check to see if it is valid array dimension, Should be greater than 0
    Else
    ;If Dimension Exists, then get the number of "Rows"
    $iUboundDim = UBound($aArray, 1) ;Get Number of "Rows"
    If @error Then Return SetError(3, 0, 0) ;2 = Array dimension is invalid.

    [/autoit] [autoit][/autoit] [autoit]

    ;If $iDimension Exists, And the number of "Rows" is Valid:
    If $iDimension > 1 Then ;Makes sure the Array dimension desired is more than 1-dimensional
    Local $aArrayTmp[1] ;Declare blank array, which will hold the dimension declared by user
    For $i = 0 To $iUboundDim - 1 ;Loop through "Rows"
    _ArrayAdd($aArrayTmp, $aArray[$i][$iDimension - 1]) ;$iDimension-1 to match Dimension
    Next
    _ArrayDelete($aArrayTmp, 0) ;Get rid of 1st-element which is blank
    Else ;Makes sure the Array dimension desired is 1-dimensional
    ;If Dimension Exists, And the number of "Rows" is Valid, and the Dimension desired is not > 1, then:
    ;For the Case that the array is 1-Dimensional
    If UBound($aArray, 0) = 1 Then ;Makes sure the Array is only 1-Dimensional
    Dim $aArrayTmp[1] ;Declare blank array, which will hold the dimension declared by user
    For $i = 0 To $iUboundDim - 1
    _ArrayAdd($aArrayTmp, $aArray[$i])
    Next
    _ArrayDelete($aArrayTmp, 0) ;Get rid of 1st-element which is blank
    Else ;For the Case that the array is 2-Dimensional
    Dim $aArrayTmp[1] ;Declare blank array, which will hold the dimension declared by user
    For $i = 0 To $iUboundDim - 1
    _ArrayAdd($aArrayTmp, $aArray[$i][$iDimension - 1]) ;$iDimension-1 to match Dimension
    Next
    _ArrayDelete($aArrayTmp, 0) ;Get rid of 1st-element which is blank
    EndIf
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $sHold ;String that holds the Unique array info
    Local $sDouble, $sDoubleIndex ; String that holds the double array info
    For $iCC = $iBase To UBound($aArrayTmp) - 1 ;Loop Through array
    ;If Not the case that the element is already in $sHold, then add it
    If Not StringInStr($vDelim & $sHold, $vDelim & $aArrayTmp[$iCC] & $vDelim, $iCase) Then
    $sHold &= $aArrayTmp[$iCC] & $vDelim
    Else
    $sDouble &= $aArrayTmp[$iCC] & printf("%003s\n", $iCC + 1) & $vDelim
    EndIf
    Next
    If $sDouble Then
    $aArrayTmp = StringSplit(StringTrimRight($sDouble, StringLen($vDelim)), $vDelim, 1) ;Split the string into an array
    ;~ _ArrayDisplay($aArrayTmp)
    Return $aArrayTmp ;SmOke_N's version used to Return SetError(0, 0, 0)
    EndIf
    Return SetError(2, 0, 0) ;If the script gets this far, it has failed
    EndFunc ;==>_ArrayUnique

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
    If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Niederwertiges Wort (WORD)
    $iCode = BitShift($iwParam, 16) ; Höherwertiges Wort (WORD)

    [/autoit] [autoit][/autoit] [autoit]

    Switch $hWndFrom
    Case $hListBox, $hWndListBox
    Switch $iCode
    Case $LBN_DBLCLK ; Wird gesendet, wenn der Benutzer einen Doppelklick auf einen String in einer ListBox ausführt
    _DebugPrint("$LBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    _LoadTracks()
    Case $LBN_ERRSPACE ; Wird gesendet, wenn eine ListBox nicht genug Speicher zugeteilt bekommt, um eine Anfrage entgegenzunehmen
    _DebugPrint("$LBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; Kein Rückgabewert
    Case $LBN_KILLFOCUS ; Wird gesendet, wenn eine ListBox den Tastatur-Fokus verliert
    _DebugPrint("$LBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; Kein Rückgabewert
    Case $LBN_SELCANCEL ; Wird gesendet, wenn der Benutzer die Auswahl in einer ListBox abbricht
    _DebugPrint("$LBN_SELCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; Kein Rückgabewert
    Case $LBN_SELCHANGE ; Wird gesendet, wenn die Auswahl in einer ListBox geändert wurde
    _DebugPrint("$LBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ;~ MsgBox(0, "", $iCode)
    Case $LBN_SETFOCUS ; Wird gesendet, wenn eine Listbox den Tastatur-Fokus erhält
    _DebugPrint("$LBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; Kein Rückgabewert
    EndSwitch
    EndSwitch
    ; Die internen Standard Autoit3-Messages-Befehle werden fortgesetzt.
    ; Die ganze Zeile kann auch weggelassen werden.
    ; !!! Aber wird nur 'Return' (ohne Rückgabewert) verwendet, so
    ; Werden spätere Standard Autoit3-Messages-Befehle nicht mehr verarbeitet !!!
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Func _DebugPrint($s_text)
    $s_text = StringReplace($s_text, @LF, @LF & "-->")
    ConsoleWrite("!===========================================================" & @LF & _
    "+===========================================================" & @LF & _
    "-->" & $s_text & @LF & _
    "+===========================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Draw_Timer($hWnd, $Msg, $iIDTimer, $dwTime)
    If Not $Pause Then
    If $i = $GFC Then $i = 0 ; If $i = the frame count then reset $i to 0
    GifDrawFrame($i)
    $i += 1
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func Quit()
    _Timer_KillAllTimers($hGUI)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_Shutdown()

    [/autoit] [autoit][/autoit] [autoit]

    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func GifInit()
    _GDIPlus_Startup()
    ; Load your animated GIF (from file or from resources)
    ;~ $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\gif-Green-UFO.gif")
    $hImage = _ResourceGetAsImage("ANI_GIF_1")

    [/autoit] [autoit][/autoit] [autoit]

    $tDL = DllStructCreate($tagGUID) ; Create a struct to hold the GUID.
    $pDimensionIDs = DllStructGetPtr($tDL) ; Get a pointer to the GUID struct.

    [/autoit] [autoit][/autoit] [autoit]

    ; Get the FrameDimensionsCount of the loaded gif
    $GFDC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsCount", "ptr", $hImage, "int*", 0)

    [/autoit] [autoit][/autoit] [autoit]

    ; Get the FrameDimensionsList , which fills the GUID struct by passing the GUID pointer and the FrameDimensionsCount.
    DllCall($ghGDIPDll, "int", "GdipImageGetFrameDimensionsList", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $GFDC[2])

    [/autoit] [autoit][/autoit] [autoit]

    ; Get the FrameCount of the loaded gif by passing the GUID pointer
    $GFC = DllCall($ghGDIPDll, "int", "GdipImageGetFrameCount", "int", $hImage, "ptr", $pDimensionIDs, "int*", 0)
    $GFC = $GFC[3]
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func GifDrawFrame($i)
    ; Select the ActiveFrame in the loaded GIF by telling it. The frame starts at 0 ($i)
    DllCall($ghGDIPDll, "int", "GdipImageSelectActiveFrame", "ptr", $hImage, "ptr", $pDimensionIDs, "int", $i)

    [/autoit] [autoit][/autoit] [autoit]

    ; get current frame from GIF and draw it on the control
    $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
    _SetBitmapToCtrl($IMG_Ctrl, $hBitmap)
    _WinAPI_DeleteObject($hBitmap)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func Printf($format, $var1)
    Return StringFormat($format, $var1)
    EndFunc ;==>Printf

    [/autoit]
  • Mail-UDF / Variablenübergabe per $CmdLine oder .ini

    • TheSystemAlien
    • 22. Oktober 2012 um 13:15

    Hey autoBert,

    du bist genial. :)

    auf die Idee wäre ich irgendwie nie gekommen, auch wenns total einleuchtend ist...

    Vielen Dank, läuft super.. :D :D

  • Mail-UDF / Variablenübergabe per $CmdLine oder .ini

    • TheSystemAlien
    • 22. Oktober 2012 um 11:04

    Danke für die schnelle Hilfe...

    Das gesamte Script:

    Spoiler anzeigen
    [autoit]

    ;
    ;##################################
    ; Include
    ;##################################
    #Include<file.au3>
    ;##################################
    ; Variables
    ;##################################

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $mailsettings = @ScriptDir & "\mailsettings.ini"

    [/autoit] [autoit][/autoit] [autoit]

    $SmtpServer = IniRead($mailsettings, 'EMailSettings', 'SmtpServer', 'KeyNotFound')
    $FromName = IniRead($mailsettings, 'EMailSettings', 'FromName', 'KeyNotFound')
    $FromAddress = IniRead($mailsettings, 'EMailSettings', 'FromAddress', 'KeyNotFound')
    $ToAddress = IniRead($mailsettings, 'EMailSettings', 'ToAddress', 'KeyNotFound')
    $Subject = IniRead($mailsettings, 'EMailSettings', 'Subject', 'KeyNotFound')
    $Body = IniRead($mailsettings, 'EMailSettings', 'Body', 'KeyNotFound')
    $AttachFiles = IniRead($mailsettings, 'EMailSettings', 'AttachFiles', 'KeyNotFound')
    $CcAddress = IniRead($mailsettings, 'EMailSettings', 'CcAddress', 'KeyNotFound')
    $BccAddress = IniRead($mailsettings, 'EMailSettings', 'BccAddress', 'KeyNotFound')
    $Importance = IniRead($mailsettings, 'EMailSettings', 'Importance', 'KeyNotFound')
    $Username = IniRead($mailsettings, 'EMailSettings', 'Username', 'KeyNotFound')
    $Password = IniRead($mailsettings, 'EMailSettings', 'Password', 'KeyNotFound')
    $IPPort = IniRead($mailsettings, 'EMailSettings', 'IPPort', 'KeyNotFound')
    $ssl = IniRead($mailsettings, 'EMailSettings', 'ssl', 'KeyNotFound')

    [/autoit] [autoit][/autoit] [autoit]

    ;~ $SmtpServer = "smtp-server.provider.tld" ; address for the smtp-server to use - REQUIRED
    ;~ $FromName = "Test" ; name from who the email was sent
    ;~ $FromAddress = "mail@mail.ch" ; address from where the mail should come
    ;~ $ToAddress = "mail@mail.ch" ; destination address of the email - REQUIRED
    ;~ $Subject = "Userinfo" ; subject from the email - can be anything you want it to be
    ;~ $Body = "This Is The Body" ; the messagebody from the mail - can be left blank but then you get a blank mail
    ;~ $AttachFiles = "" ; the file you want to attach- leave blank if not needed
    ;~ $CcAddress = "" ; address for cc - leave blank if not needed
    ;~ $BccAddress = "" ; address for bcc - leave blank if not needed
    ;~ $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
    ;~ $Username = "username" ; username for the account used from where the mail gets sent - REQUIRED
    ;~ $Password = "password" ; password for the account used from where the mail gets sent - REQUIRED
    ;~ $IPPort = 25 ; port used for sending the mail
    ;~ $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit]

    ;~ $IPPort=465 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit] [autoit][/autoit] [autoit]

    ;##################################
    ; Script
    ;##################################
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    ;~ MsgBox(0, "", $SmtpServer & @CRLF & $FromName & @CRLF & $FromAddress & @CRLF & $ToAddress & @CRLF & $Subject & @CRLF & $Body & @CRLF & $AttachFiles & @CRLF & $CcAddress & @CRLF & $BccAddress & @CRLF & $Username & @CRLF & $Password & @CRLF & $IPPort & @CRLF & $ssl)
    $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
    ;~ MsgBox(0, "", $rc)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    EndIf
    ;
    ; The UDF
    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
    ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
    SetError(1)
    Return 0
    EndIf
    Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 then $IPPort = 25
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Set Email Importance
    Switch $s_Importance
    Case "High"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
    Case "Normal"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
    Case "Low"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
    SetError(2)
    Return $oMyRet[1]
    EndIf
    $objEmail=""
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]

    Inhalt der .INI:

    Spoiler anzeigen

    [EMailSettings]
    SmtpServer = smtp-server.provider.tld
    FromName = Armon Oswald
    FromAddress = donotreply@mail.ch
    ToAddress = mail@mail.ch
    Subject = Backupblabla
    Body = ThisIsTheBody
    AttachFiles =
    CcAddress =
    BccAddress =
    Importance = Normal
    Username = popusername
    Password = pop_password
    IPPort = 25
    ssl = 0

    Wie vorhin sind meine E-Mail-Daten zensiert.. Die Mail-Einstellungen sollten jedoch nicht so eine grosse Rolle spielen. Das Problem sollte meiner Meinung nach wo anders liegen... nur wo ist die gute frage :(
    Und wie gesagt, schlussendlich müssten dann die Variablen wie folgt aussehen (wegen der Kommandozeilenübergabe):

    Spoiler anzeigen
    [autoit]

    $mailsettings = @ScriptDir & "\mailsettings.ini"

    [/autoit] [autoit][/autoit] [autoit]

    $SmtpServer = IniRead($mailsettings, 'EMailSettings', 'SmtpServer', 'KeyNotFound')
    $FromName = IniRead($mailsettings, 'EMailSettings', 'FromName', 'KeyNotFound')
    $FromAddress = IniRead($mailsettings, 'EMailSettings', 'FromAddress', 'KeyNotFound')
    $ToAddress = IniRead($mailsettings, 'EMailSettings', 'ToAddress', 'KeyNotFound')
    $Subject = $CmdLine[1]
    $Body = $CmdLine[2]
    $AttachFiles = $CmdLine[3]
    $CcAddress = IniRead($mailsettings, 'EMailSettings', 'CcAddress', 'KeyNotFound')
    $BccAddress = IniRead($mailsettings, 'EMailSettings', 'BccAddress', 'KeyNotFound')
    $Importance = IniRead($mailsettings, 'EMailSettings', 'Importance', 'KeyNotFound')
    $Username = IniRead($mailsettings, 'EMailSettings', 'Username', 'KeyNotFound')
    $Password = IniRead($mailsettings, 'EMailSettings', 'Password', 'KeyNotFound')
    $IPPort = IniRead($mailsettings, 'EMailSettings', 'IPPort', 'KeyNotFound')
    $ssl = IniRead($mailsettings, 'EMailSettings', 'ssl', 'KeyNotFound')

    [/autoit]
  • Mail-UDF / Variablenübergabe per $CmdLine oder .ini

    • TheSystemAlien
    • 22. Oktober 2012 um 10:42

    Hallo Leute :D

    Ich bin gerade dabei, für mich ein kleines Backup-Programm zu schreiben, welches mit Hilfe von robocopy Files kopiert. Nun, jedesmal wenn ein Backup fehler produziert, werden diese von Robocopy, oder auch von meiner eigenen .exe in ein Log-File geschrieben, welches ich mir sehr gerne aufs Mail legen würde, damit ich die Logfiles nicht immer selbst anschauen (und suchen) muss.

    Ich habe dazu folgende Mail-UDF genommen (,welche schon im 2007 zu viel Gesprächsstoff geführt hatte):
    http://www.autoitscript.com/forum/topic/23…nd-attachments/

    Es gab auch schon mehrere Threads zu dieser UDF, wie dieser hier: [ gelöst ] Email Senden
    Leider half mir dieser auch nicht weiter..

    Original-UDF:

    [autoit]

    $SmtpServer = "smtp-server.provider.tld" ; address for the smtp-server to use - REQUIRED
    $FromName = "Test" ; name from who the email was sent
    $FromAddress = "mail@mail.ch" ; address from where the mail should come
    $ToAddress = "mail@mail.ch" ; destination address of the email - REQUIRED
    $Subject = "Userinfo" ; subject from the email - can be anything you want it to be
    $Body = "This Is The Body" ; the messagebody from the mail - can be left blank but then you get a blank mail
    $AttachFiles = "" ; the file you want to attach- leave blank if not needed
    $CcAddress = "" ; address for cc - leave blank if not needed
    $BccAddress = "" ; address for bcc - leave blank if not needed
    $Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
    $Username = "username" ; username for the account used from where the mail gets sent - REQUIRED
    $Password = "password" ; password for the account used from where the mail gets sent - REQUIRED
    $IPPort = 25 ; port used for sending the mail
    $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS

    [/autoit][autoit][/autoit][autoit]

    ;~ $IPPort=465 ; GMAIL port used for sending the mail
    ;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

    ;##################################
    ; Script
    ;##################################
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
    MsgBox(0, "", $SmtpServer & @CRLF & $FromName & @CRLF & $FromAddress & @CRLF & $ToAddress & @CRLF & $Subject & @CRLF & $Body & @CRLF & $AttachFiles & @CRLF & $CcAddress & @CRLF & $BccAddress & @CRLF & $Username & @CRLF & $Password & @CRLF & $IPPort & @CRLF & $ssl)
    $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
    ;~ MsgBox(0, "", $rc)
    If @error Then
    MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
    EndIf
    ;
    ; The UDF
    Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
    $objEmail.HTMLBody = $as_Body
    Else
    $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
    Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
    For $x = 1 To $S_Files2Attach[0]
    $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
    ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment ($S_Files2Attach[$x])
    Else
    ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
    SetError(1)
    Return 0
    EndIf
    Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 then $IPPort = 25
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Set Email Importance
    Switch $s_Importance
    Case "High"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
    Case "Normal"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
    Case "Low"
    $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
    SetError(2)
    Return $oMyRet[1]
    EndIf
    $objEmail=""
    EndFunc ;==>_INetSmtpMailCom
    ;
    ;
    ; Com Error Handler
    Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]

    Nun, wenn ich diese UDF in einem Script (oder auch kompiliert) verwende, funktioniert alles super (ich habe meine Maildaten natürlich nicht hier posten wollen).
    Wenn ich aber die E-Mail-Variablen per IniRead() einlese, dann kommt der Fehler Nummer 2: Der Transport konnte keine Verbindung zum Server herstellen:

    [autoit]

    $mailsettings = @ScriptDir & "\mailsettings.ini"
    $SmtpServer = IniRead($mailsettings, 'EMailSettings', 'SmtpServer', 'KeyNotFound')
    $FromName = IniRead($mailsettings, 'EMailSettings', 'FromName', 'KeyNotFound')
    $FromAddress = IniRead($mailsettings, 'EMailSettings', 'FromAddress', 'KeyNotFound')
    $ToAddress = IniRead($mailsettings, 'EMailSettings', 'ToAddress', 'KeyNotFound')
    $Subject = IniRead($mailsettings, 'EMailSettings', 'Subject', 'KeyNotFound')
    $Body = IniRead($mailsettings, 'EMailSettings', 'Body', 'KeyNotFound')
    $AttachFiles = IniRead($mailsettings, 'EMailSettings', 'AttachFiles', 'KeyNotFound')
    $CcAddress = IniRead($mailsettings, 'EMailSettings', 'CcAddress', 'KeyNotFound')
    $BccAddress = IniRead($mailsettings, 'EMailSettings', 'BccAddress', 'KeyNotFound')
    $Importance = IniRead($mailsettings, 'EMailSettings', 'Importance', 'KeyNotFound')
    $Username = IniRead($mailsettings, 'EMailSettings', 'Username', 'KeyNotFound')
    $Password = IniRead($mailsettings, 'EMailSettings', 'Password', 'KeyNotFound')
    $IPPort = IniRead($mailsettings, 'EMailSettings', 'IPPort', 'KeyNotFound')
    $ssl = IniRead($mailsettings, 'EMailSettings', 'ssl', 'KeyNotFound')

    [/autoit]

    Ich habe diese Variablen überprüft und sie werden eins zu eins richtig übergeben, aber es entsteht dieser Fehler.
    Ich stehe ziemlich auf dem Schlauch mit diesem Problem und hoffe, dass Ihr bessere Ideen habt als ich. :)

    Schlussendlich sollte es eine mail.exe geben, welcher ich bestimmte Parameter per $CmdLine übergeben kann (Der Body, das AttachFile und das Subject sollten schlussendlich per $CmdLine kommen, der Rest aus der Ini)

    Ich bedanke mich schonmal für eure Hilfe und hoffe, dass ich euch mit dem doch inzwischen ziemlich alten Problem nicht zu sehr nerve. :)

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™