﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
947	RegRead fails for the first try reading a key	funkey	Valik	"When I change the key for example from 'DeviceConnect' to 'DeviceFail' then I get an error from RegRead (only) for the first time. You can see it at the Console. I use Windows XP SP2 and Autoit V3.3.0.0

{{{
_PlayDefaultSystemSound('DeviceConnect', 1)

; #FUNCTION# ====================================================================================================================
; Name...........:    _PlayDefaultSystemSound()
; Description ...:    Plays a Default System Sound
; Syntax.........:    _PlayDefaultSystemSound($sSoundName, $iWait = 0)
; Parameters ....:    $sSoundName                - Name des SystemSound's
;                    | Default                   - Standardton Warnsignal / Default Beep
;                    | CriticalBatteryAlarm      - Alarm bei kritischem Batteriestand / when battery is critical
;                    | DeviceConnect            - Geräteanschluß / when a device is connect
;                    | DeviceDisconnect          - Gerätetrennung / when a device is disconnect
;                    | DeviceFail                - Geräteanschluß fehlgeschlagen / when a deviceconnect is fail
;                    | LowBatteryAlarm           - Alarm bei niedrigem Batteriestand / when battery is low
;                    | MailBeep                  - Posteingangsbenachrichtigung / when email is received
;                    | SystemAsterisk            - Stern / Asterisk
;                    | SystemExclamation         - Hinweis / when windows shows a warning
;                    | SystemExit                - Windows beenden / when Windows shuts down
;                    | SystemHand                - Kritischer Abbruch / when a critical stop occurs
;                    | SystemNotification        - Sprechblase / when a critical stop occurs
;                    | SystemStart               - Windows starten / when Windows starts up
;                    | WindowsLogoff             - beim Windows abmelden / when logging off Windows
;                    | WindowsLogon              - beim Windows anmelden / when logging on Windows
;                    | EmptyRecycleBin           - Löschen des Papierkorbs / when recycle bin is emptied
;                    | Navigating                - Browser Klick / navigating in browser

;                     $iWait                     - Wait until SoundPlay ends? (0 = no / 1 = yes)
; Return values .:    -----
; Author ........:    funkey (AutoIt.de)
; ===============================================================================================================================

Func _PlayDefaultSystemSound($sSoundName, $iWait = 0)
    ; funkey
    Local $sKey = 'HKEY_USERS\.Default\AppEvents\Schemes\Apps\.Default'
    If $sSoundName = 'EmptyRecycleBin' Or $sSoundName = 'Navigating' Then $sKey = 'HKEY_USERS\.Default\AppEvents\Schemes\Apps\Explorer'
    ConsoleWrite(RegRead($sKey &'\' & $sSoundName & '\' & '\.Default', '')&@CRLF&@error&@CRLF)    ;Output to Console
    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   ;==>_PlaySystemSound
}}}"	Bug	closed		AutoIt	3.3.0.0	None	No Bug	RegRead	
