Ich habe erst vor kurzem mit AutoIt angefangen und habe nun mit einem Kollegen versucht, einen Musikplayer hinzubekommen.
Das öffnen und abspielen klappt schonmal. Aber die Pause-Funktion will leider nicht gehen.
Ich glaube es liegt an der Headerdatei Sound.au3 aber ich wäre froh, wenn jemand denn Fehler entdeckt!
Danke schonmals.
C
#include <GUIConstants.au3>
#include <Sound.au3>
#include <string.au3>
#include <array.au3>
#Include <GuiStatusBar.au3>
#include <GUIConstants.au3>
Global $zaehler = "0",$Listbox1, $ListBox2
global $file, $WS_HSCROLL, $Song1="1", $Song2="2",$Song3="3",$Song4="4", $Song5="5", $Song6="6", $Song7="7", $Song8="8", $Song9="9", $Song10="10", $Song11="11", $Song12="12", $Song13="13", $Sound
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Player", 365, 316, 652, 187)
GUISetBkColor(0xC8C8C8)
$filemenu = GUICtrlCreateMenu("Datei")
$fileitem = GUICtrlCreateMenuItem("Öffnen...", $filemenu)
$helpmenu = GUICtrlCreateMenu("?")
$aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)
$ListBox1 = GUICtrlCreateList("", 8, 32, 249, 201)
$Button7 = GUICtrlCreateButton("Öffnen...", 272, 40, 81, 25, 0)
$Label1 = GUICtrlCreateLabel("Musikdatei", 8, 8, 46, 20)
GUICtrlSetFont(-1, 10, 400, 2, "Century Gothic")
$Button1 = GUICtrlCreateButton("Entfernen", 272, 75, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Play", 56, 248, 70, 41, 0)
GUICtrlSetImage(-1, "shell32.dll", 246)
$Button4 = GUICtrlCreateButton("Pause", 136, 248, 70, 41, 0)
GUICtrlSetImage(-1, "shell32.dll", 200)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Func _fileOpen()
Local $file = FileOpenDialog("Musikdatei auswählen", "C:", "Song files (*.mp3; *.wma; *.wav)", 2+1)
If @error Then Return
GUICtrlSetData($ListBox1,$file)
;If $Song1 = "1" Then
; $Song1 = $file
EndFunc ;==>_fileOpen
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button7
_fileOpen()
Case $msg = $Button3
$Sound = GUICtrlRead($ListBox1)
SoundPlay($Sound)
Case $msg = $Button4
_SoundPause($Sound) ;Hier ist irgendwo der Fehler, könnte es sein, das die Variable $Sound hier nicht abrufbar ist?
Case $msg = $Button3
_SoundResume($Sound)
EndSelect
WEnd
Alles anzeigen