diff --git a/source/Launcher/Enderal Launcher.au3 b/source/Launcher/Enderal Launcher.au3 index 3129a5dab..2730a6ac1 100644 --- a/source/Launcher/Enderal Launcher.au3 +++ b/source/Launcher/Enderal Launcher.au3 @@ -258,38 +258,9 @@ Func UpdateModIniButtonState() EndFunc Func RunWithAssociation($filePath) - ; Get file extension - Local $ext = StringRegExpReplace($filePath, ".*(\.[^.]+)$", "$1") - If $ext = $filePath Then Return False - - ; Get file type from registry - Local $fileType = RegRead("HKEY_CLASSES_ROOT\" & $ext, "") - If @error Or $fileType = "" Then - ; Fallback to notepad if no association found - Run('notepad.exe "' & $filePath & '"') - Return True - EndIf - - ; Get command for opening this file type - Local $command = RegRead("HKEY_CLASSES_ROOT\" & $fileType & "\shell\open\command", "") - If @error Or $command = "" Then - ; Fallback to notepad if no command found - Run('notepad.exe "' & $filePath & '"') - Return True - EndIf - - ; Replace %1 or %L with the file path, handle quoted and unquoted variants - If StringInStr($command, "%1") Or StringInStr($command, "%L") Then - $command = StringReplace($command, '"%1"', '"' & $filePath & '"') - $command = StringReplace($command, "%1", '"' & $filePath & '"') - $command = StringReplace($command, '"%L"', '"' & $filePath & '"') - $command = StringReplace($command, "%L", '"' & $filePath & '"') - Else - ; Append file path if no placeholder - $command = $command & ' "' & $filePath & '"' - EndIf - - Run($command) + ; The shell resolves the association and expands REG_EXPAND_SZ paths itself + ShellExecute($filePath) + If @error Then Run('notepad.exe "' & $filePath & '"') Return True EndFunc