#include <File.au3>
$rompath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Frogster Interactive Pictures\Runes of Magic", "RootDir")
If Not FileExists($rompath) Then
	$rompath = FileSelectFolder("Reg Eintrag nicht gefunden. Bitte das Runes of Magic Verzeichnis suchen.", @DesktopDir, 2)
	If @error Then Exit
EndIf
$copyPath = FileSelectFolder("Bitte Speicherverzeichnis für die Patches suchen", @DesktopDir, 1 + 2 + 4)
If @error Then Exit
While 1
	WinWait("RomUpdate")
	$list = _FileListToArray($rompath, "*.exe", 1)
	For $x = 1 To $list[0]
		If StringInStr($list[$x], "patch_") > 0 Then
			If Not FileExists($copyPath & "\" & $list[$x]) Then
				FileCopy($rompath & "\" & $list[$x], $copyPath & "\" & $list[$x])
			EndIf
			ExitLoop
		EndIf
	Next
WEnd

