soundplay problem

  • hi leute,
    ich hab mich mal an die 2te version des weckers gemacht... aber als ich ihn getestet habe, kam kein ton... ich weiß wirklich nicht woran es liegt. :(
    in der 1ten version hat alles noch wunderbar geklappt...

    hier der code:

    Spoiler anzeigen
    [autoit]

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

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

    AutoIt Version: 3.2.13.12 (beta)
    Author: Johann Lentz

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

    Script Function:
    Template AutoIt script.

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

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

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

    ; Script Start - Add your code below here
    #Region ### Includes
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <file.au3>
    $Normal = "Alarm.mp3"
    FileInstall ("C:\Dokumente und Einstellungen\Johann Lentz\Eigene Dateien\Skripte\Alarm.mp3",@ScriptDir & "\Alarm.mp3")
    #EndRegion ### Includes

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

    #Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\Johann Lentz\Eigene Dateien\Skripte\wecker.v2.kxf
    $Form1 = GUICreate("Wecker", 412, 341, 272, 302)
    GUISetBkColor(0xA6CAF0)
    $Label1 = GUICtrlCreateLabel("Wecker", 176, 16, 69, 28)
    GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
    $Group1 = GUICtrlCreateGroup("Wecker", 64, 56, 121, 241)
    $Button1 = GUICtrlCreateButton("Wecker", 88, 72, 75, 25)
    $Input1 = GUICtrlCreateInput("", 80, 152, 33, 21)
    $Input2 = GUICtrlCreateInput("", 120, 152, 33, 21)
    $Label2 = GUICtrlCreateLabel(":", 113, 152, 9, 28)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    $Button4 = GUICtrlCreateButton("Start", 80, 248, 75, 25)
    $Button2 = GUICtrlCreateButton("Extras", 80, 216, 75, 25)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group3 = GUICtrlCreateGroup("Herunterfahren", 240, 56, 113, 241)
    $Button3 = GUICtrlCreateButton("Pc herunterfahren", 248, 72, 99, 25)
    $Button6 = GUICtrlCreateButton("Start", 256, 248, 75, 25)
    $Input5 = GUICtrlCreateInput("", 255, 152, 33, 21)
    $Input6 = GUICtrlCreateInput("", 297, 152, 33, 21)
    $Label4 = GUICtrlCreateLabel(":", 288, 152, 9, 28)
    GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Label3 = GUICtrlCreateLabel("Copyright © by Johann Lentz", 256, 312, 141, 17)
    $Label5 = GUICtrlCreateLabel("--:--:--" , 32, 312, 98, 17)
    GUISetState(@SW_SHOW)

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

    $Form1_1 = GUICreate("Extras", 497, 355, 659, 116)
    GUISetBkColor(0xA6CAF0)
    $Input7 = GUICtrlCreateInput("Alarm.mp3", 24, 88, 89, 21)
    $Button8 = GUICtrlCreateButton("Standard", 24, 32, 75, 25, 0)
    $Group10 = GUICtrlCreateGroup("Weckton", 8, 8, 209, 113)
    $Button9 = GUICtrlCreateButton("Eigener Ton", 112, 32, 75, 25, 0)
    $Button10 = GUICtrlCreateButton("Suchen", 128, 88, 75, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group20 = GUICtrlCreateGroup("Nachricht", 256, 8, 209, 113)
    $Input8 = GUICtrlCreateInput("", 296, 80, 121, 21)
    $Label10 = GUICtrlCreateLabel("Geben sie hier ihre Nachricht ein, die bei ", 264, 32, 198, 17)
    $Label20 = GUICtrlCreateLabel("dem Weckruf gezeigt werden soll.", 280, 56, 164, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Group3 = GUICtrlCreateGroup("Start eines Programmes", 56, 136, 353, 145)
    $Label30 = GUICtrlCreateLabel("Geben sie hier bitte den Pfad zu der Datei an, die", 104, 160, 236, 17)
    $Label40 = GUICtrlCreateLabel("zum Weckruf ausgeführt werden soll.", 104, 176, 179, 17)
    $Label50 = GUICtrlCreateLabel("(Falls sie dies nich wollen lassen sie das Feld bitte frei)", 104, 192, 257, 17)
    $Input9 = GUICtrlCreateInput("", 112, 232, 121, 21)
    $Button11 = GUICtrlCreateButton("Suchen", 248, 232, 75, 25, 0)
    $Button12 = GUICtrlCreateButton("Speichern", 176, 304, 115, 25, 0)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_HIDE)

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

    #EndRegion ### END Koda GUI section ###

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

    GUICtrlSetState ( $Button4, $GUI_DISABLE)
    GUICtrlSetState ( $Button6, $GUI_DISABLE)
    GUICtrlSetState ( $Input1, $GUI_DISABLE)
    GUICtrlSetState ( $Input2, $GUI_DISABLE)
    GUICtrlSetState ( $Input5, $GUI_DISABLE)
    GUICtrlSetState ( $Input6, $GUI_DISABLE)
    GUICtrlSetState ( $Button2, $GUI_DISABLE)

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

    #Region ### Refresh
    Func _Refresh()
    GUICtrlSetData ($Label5, @hour &":"& @min &":"& @sec)
    EndFunc

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


    AdLibEnable ("_Refresh")
    #EndRegion ### Refresh

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

    #Region ### While- Schleife
    While 1
    $Msg = GUIGetMsg(1)
    Switch $Msg[1]
    Case $Form1
    Switch $Msg[0]
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _Wecker()

    Case $Button2
    GUISetState(@SW_SHOW, $Form1_1)

    Case $Button3
    _Herunterfahren()

    Case $Button4
    GUISetState (@SW_HIDE,$Form1)
    _StartWecker()
    GUISetState(@SW_SHOW,$Form1)
    $Ton2 = GUICtrlRead ($Input7)
    SoundPlay ($Ton2)
    _ProgrammStart()
    _Nachricht()
    Case $Button6
    GUISetState (@SW_HIDE)
    _StartHerunterfahren()
    Shutdown (5)

    EndSwitch
    Case $Form1_1
    Switch $Msg[0]
    Case $GUI_EVENT_CLOSE
    GUISetState(@SW_HIDE, $Form1_1)
    Case $Button8
    GUICtrlSetState ( $Input7, $GUI_DISABLE)
    GUICtrlSetState ( $Button10, $GUI_DISABLE)
    GUICtrlSetData ($Input7, $Normal)
    Case $Button9
    GUICtrlSetState ( $Input7, $GUI_ENABLE)
    GUICtrlSetState ( $Button10, $GUI_ENABLE)
    Case $Button10
    $Ton = FileOpenDialog ("Ton wählen:", "", " Musik (*.mp3)", 1)
    GUICtrlSetData ($Input7, $Ton)

    Case $Button11
    $Programm = FileOpenDialog ("TProgramm wählen:", "", " ausführbare Datei (*.exe)", 1)
    GUICtrlSetData ($Input9, $Programm)

    Case $Button12
    GUISetState (@SW_HiDE, $Form1_1)
    EndSwitch
    EndSwitch
    WEnd
    #EndRegion ### While- Schleife

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

    #Region ### Funcs

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

    Func _ProgrammStart()
    If GUICtrlRead($Input9) = "" Then
    Sleep (1)
    Else
    Run (guictrlread($Input9))
    EndIf
    EndFunc

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

    Func _Nachricht()
    If GUICtrlRead($Input8) = "" Then
    Sleep (1)
    Else
    MsgBox (0, "Nachricht", guictrlread($Input8))
    EndIf
    EndFunc

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

    Func _Wecker()
    GUICtrlSetState ( $Button3, $GUI_DISABLE)
    GUICtrlSetState ( $Button6, $GUI_DISABLE)
    GUICtrlSetState ( $Input5, $GUI_DISABLE)
    GUICtrlSetState ( $Input6, $GUI_DISABLE)
    GUICtrlSetState ( $Input1, $GUI_ENABLE)
    GUICtrlSetState ( $Input2, $GUI_ENABLE)
    GUICtrlSetState ( $Button4, $GUI_ENABLE)
    GUICtrlSetState ( $Button2, $GUI_ENABLE)
    EndFunc

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

    Func _Herunterfahren()
    GUICtrlSetState ( $Button1, $GUI_DISABLE)
    GUICtrlSetState ( $Button4, $GUI_DISABLE)
    GUICtrlSetState ( $Input1, $GUI_DISABLE)
    GUICtrlSetState ( $Input2, $GUI_DISABLE)
    GUICtrlSetState ( $Input5, $GUI_ENABLE)
    GUICtrlSetState ( $Input6, $GUI_ENABLE)
    GUICtrlSetState ( $Button6, $GUI_ENABLE)
    EndFunc

    Func _StartWecker()
    $hour1 = GUICtrlRead ($Input1)
    $min1 = GUICtrlRead ($Input2)

    Do

    Sleep (999)

    Until $hour1 = @HOUR And $min1 = @MIN

    GUISetState (@SW_SHOW)
    EndFunc


    Func _StartHerunterfahren()
    $hour2 = GUICtrlRead ($Input5)
    $min2 = GUICtrlRead ($Input6)

    Do

    Sleep (999)

    Until $hour2 = @HOUR And $min2 = @MIN

    GUISetState (@SW_SHOW)
    EndFunc

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

    #EndRegion ### Funcs

    [/autoit]
  • Also beim mir kommt ein Ton.
    Ich habe den Wecker aktiviert und die Datei namens "C:\alarm.mp3" ausgewählt.

    Es funktioniert.

    Hast du vielleicht einen Schreibfehler in der Sounddatei?

  • ooh gott.. wasn heute nur mit mir los? bin ich verrückt? vorhin gings nich... aber jetzt :D oooooh mann... sorry jungs