1. Es soll der Reihe nach die Songs von der Playlist abspielen, und $stop funktioniert nicht:
PHP Code:
#include <GUIConstants.au3>
#include <Array.au3>
#include <String.au3>
#include <Sound.au3>
#Include <GuiListBox.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#RequireAdmin
Global $numbers[1]
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("PlaysiX by mipez", 609, 303, 200, 126)
GUISetOnEvent ( $GUI_EVENT_CLOSE, "_exit")
$playlist = GUICtrlCreateList("", 376, 16, 209, 214)
$volume = GUICtrlCreateSlider(16, 48, 337, 41)
$fileadd = GUICtrlCreateButton("Add new File", 376, 248, 209, 33, 0)
$play = GUICtrlCreateButton("Play", 128, 88, 81, 73, 0)
GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
$pause = GUICtrlCreateButton("Pause", 32, 96, 81, 57, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
Global $stop = GUICtrlCreateButton("Stop", 224, 96, 81, 57, 0)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$save = GUICtrlCreateButton("Save Playlist", 24, 248, 161, 33, 0)
$labelnow = GUICtrlCreateLabel("Now:", 32, 176, 53, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$labelnext = GUICtrlCreateLabel("Next:", 32, 207, 53, 28)
GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif")
$labelvolume = GUICtrlCreateLabel("Volume", 136, 16, 96, 36)
GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
$last = GUICtrlCreateButton("Last", 320, 96, 41, 25, 0)
$next = GUICtrlCreateButton("Next", 320, 127, 41, 25, 0)
GUISetState(@SW_SHOW)
GUICtrlSetOnEvent ( $play, "_play" )
GUICtrlSetOnEvent ( $volume, "_volume" )
GUICtrlSetOnEvent ( $fileadd, "_fileadd" )
GUICtrlSetOnEvent ( $playlist, "_DoubleClick" )
GUICtrlSetOnEvent ( $save, "_save" )
_load()
While 1
Sleep(100)
WEnd
Func _exit()
Exit 0
EndFunc
Func _MouseOverControl()
Local $WindowPos, $ControlPos, $MousePos
Dim $WindowPos, $ControlPos, $MousePos
$WindowPos = WinGetPos ( @GUI_WinHandle )
$ControlPos = ControlGetPos ( @GUI_WinHandle, "", @GUI_CtrlId )
$MousePos = MouseGetPos ()
If $MousePos[0] > $WindowPos[0] + $ControlPos[0] And $MousePos[1] > $WindowPos[1] + $ControlPos[1] And $MousePos[0] < $WindowPos[0] + $ControlPos[0] + $ControlPos[2] And $MousePos[1] < $WindowPos[1] + $ControlPos[1] + $ControlPos[3] Then
Return True
Else
Return False
EndIf
EndFunc
Func _DoubleClick ( )
Local $controlID, $read, $timestamp, $dll, $executed
$controlID = @GUI_CtrlId
$read = GUICtrlRead ($controlID)
$dll = DllOpen ( "user32.dll" )
$timestamp = TimerInit()
$executed = False
Do
If _IsPressed ( "01", $dll ) And GUICtrlRead ( $controlID ) = $read And _MouseOverControl () Then
$executed = True
_play()
EndIf
Until TimerDiff ( $timestamp ) > 750 Or $executed
DllClose ( $dll )
EndFunc
Func _save()
For $i = 0 To _GUICtrlListBox_GetCount($playlist) -1
$liste = _GUICtrlListBox_GetText($playlist,$i)
IniWrite(@ScriptDir & "\playlist.ini", "MP3", $i, $liste)
Next
EndFunc
Func _fileadd()
$open = FileOpenDialog("Add a new file", @ScriptDir, "Music files (*.mp3)",1)
GUICtrlSetData($playlist, $open)
EndFunc
Func _load()
Local $numbers2 = IniReadSection("playlist.ini", "MP3"), $string = ""
If @error Then Return
Global $numbers[Ubound($numbers2, 1)]
For $i = 0 To Ubound($numbers2, 1) - 1
$string &= $numbers2[$i][1] & "|"
$numbers[$i] = $numbers2[$i][1]
Next
GUICtrlSetData($playlist, $string )
EndFunc
Func _volume()
$slider1 = GUICtrlRead($volume)
SoundSetWaveVolume($slider1)
EndFunc
Func _play()
$mis3 = _GUICtrlListBox_GetCount($playlist)
For $i = 0 To $mis3 -1
$liste = _GUICtrlListBox_GetText($playlist,$i)
_SoundPlay($liste)
If @error Then
MsgBox(0,"Error","Couldn't find file on this path")
ExitLoop
EndIf
GUICtrlCreateLabel($liste, 80, 183)
Switch GUiGetMsg ()
Case $GUI_EVENT_CLOSE
Exit
Case $stop
_SoundStop($liste)
ExitLoop
EndSwitch
Next
EndFunc
2. _change() schließt das Prog und ich will den Fortschritt in der Processbar richtig angezeigt haben (Problem is, dass das ne heikle Rechnerei is... ich brauch nur 'n Anhaltspunkt), temp_dat.ini löscht's nicht:
PHP Code:
#RequireAdmin
#Include <GuiComboBox.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#include <file.au3>
#include <string.au3>
#Include <GuiListBox.au3>
#include <Date.au3>
Global $set[1], $tex[1], $cou[1], $typ[1], $dat[1], $tim[1]
Opt("GUIOnEventMode", 1)
$filemanager = GUICreate("FileNameManager by mipez", 598, 327, 197, 129)
GUISetOnEvent ( $GUI_EVENT_CLOSE, "_exit")
$list1 = GUICtrlCreateList("", 8, 32, 241, 279)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
$loadbutton = GUICtrlCreateButton("Load Files", 264, 40, 121, 25, 0)
$text = GUICtrlCreateInput("Text", 264, 88, 177, 21)
$progress = GUICtrlCreateProgress(264, 280, 321, 17)
$filelabel = GUICtrlCreateLabel("Files", 104, 0, 62, 28)
GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
$resetbutton = GUICtrlCreateButton("Reset List", 408, 40, 121, 25, 0)
$counter = GUICtrlCreateInput("Counter", 456, 88, 57, 21)
$type = GUICtrlCreateInput("Type", 528, 88, 57, 21)
$changebutton = GUICtrlCreateButton("Change Files", 264, 240, 321, 25, 0)
$datetimecheck = GUICtrlCreateCheckbox("Use Date/Time", 264, 128, 97, 17)
$settingscheck = GUICtrlCreateCheckbox("Use preset Settings", 264, 160, 110, 17)
$datetimecombo = GUICtrlCreateCombo("", 392, 128, 193, 25)
GUICtrlSetData(-1, "Only Date|Only Time|Both")
GUICtrlSetState(-1, $GUI_DISABLE)
$settingscombo = GUICtrlCreateCombo("", 392, 160, 193, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$resetsettingsbutton = GUICtrlCreateButton("Reset Settings", 448, 200, 137, 25, 0)
$savebutton = GUICtrlCreateButton("Save Settings", 264, 200, 145, 25, 0)
$helpbutton = GUICtrlCreateButton("?", 560, 40, 25, 25, 0)
$settingslabel = GUICtrlCreateLabel("Settings", 376, 0, 110, 36)
GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
GUICtrlSetOnEvent($loadbutton, "_load")
GUICtrlSetOnEvent($resetbutton, "_resetlist")
;GUICtrlSetOnEvent($changebutton, "_change")
GUICtrlSetOnEvent($resetsettingsbutton, "_resetsettings")
GUICtrlSetOnEvent($savebutton, "_save")
GUICtrlSetOnEvent($helpbutton, "_help")
GUICtrlSetOnEvent($settingscombo,"_getsettings")
GUICtrlSetOnEvent($datetimecombo,"_getdatetime")
_loadsettings()
While 1
Sleep(100)
_checkclicked()
Switch GUIGetMsg()
Case $GUI_EVENT_DROPPED
GUICtrlSetData($list1, @GUI_DragFile)
EndSwitch
WEnd
Func _loadsettings()
Local $set2 = IniReadSection("settings.ini","Name"), $string = ""
If @error Then Return
Global $set[Ubound($set2, 1)]
; Schreibe Namen in einen eindimensionalen Array und bestimme gleichzeitig den Inhalt der Combo
For $i = 0 To Ubound($set2, 1) - 1
$string &= $set2[$i][1] & "|"
$set[$i] = $set2[$i][1]
Next
GUICtrlSetData($settingscombo, $string )
; Lade Text
$tex = IniReadSection("settings.ini", "Text")
If @error Then Return
; Lade Counter
$cou = IniReadSection("settings.ini", "Counter")
If @error Then Return
; Lade Type
$typ = IniReadSection("settings.ini", "Type")
If @error Then Return
; Lade Date
$dat = _NowCalcDate()
If @error Then Return
; Lade Time
$tim = _NowTime(5)
If @error Then Return
EndFunc
Func _save()
Local $ft1 = GUICtrlRead($text), $ft2 = GUICtrlRead($counter), $ft3 = GUICtrlRead($type), $a = UBound($tex)
$rf1 = InputBox("Name","Set a name for your settings")
IniWrite(@ScriptDir & "\settings.ini", "Name", "Name" & $a, $rf1)
IniWrite(@ScriptDir & "\settings.ini", "Text", "Text" & $a, $ft1)
IniWrite(@ScriptDir & "\settings.ini", "Counter", "Counter" & $a, $ft2)
IniWrite(@ScriptDir & "\settings.ini", "Type", "Type" & $a, $ft3)
_loadsettings()
EndFunc
Func _getdatetime()
Local $str2 = GUICtrlRead($datetimecombo)
If $str2 = "Only Date" Then
GUICtrlSetData($text, $dat)
ElseIf $str2 = "Only Time" Then
GUICtrlSetData($text, $tim)
ElseIf $str2 = "Both" Then
GUICtrlSetData($text, $dat & "-" & $tim)
EndIf
EndFunc
Func _getsettings()
Local $str = GUICtrlRead($settingscombo)
Local $index = _ArraySearch($set, $str)
If @error Then Return
GUICtrlSetData($text, $tex[$index][1])
GUICtrlSetData($counter, $cou[$index][1])
GUICtrlSetData($type, $typ[$index][1])
EndFunc
Func _exit()
FileDelete(@ScriptDir & "\temp_dat.ini")
Exit 0
EndFunc
Func _checkclicked()
If GUICtrlRead($datetimecheck) = 1 Then
GUICtrlSetState($datetimecombo, $GUI_ENABLE)
Else
GUICtrlSetState($datetimecombo, $GUI_DISABLE)
EndIf
If GUICtrlRead($settingscheck) = 1 Then
GUICtrlSetState($settingscombo, $GUI_ENABLE)
Else
GUICtrlSetState($settingscombo, $GUI_DISABLE)
EndIf
EndFunc
Func _resetsettings()
GUICtrlSetData($text,"Text")
GUICtrlSetData($counter,"Counter")
GUICtrlSetData($type,"Type")
GUICtrlSetState($datetimecheck,$GUI_UNCHECKED)
GUICtrlSetState($settingscheck,$GUI_UNCHECKED)
EndFunc
Func _load()
$open = FileOpenDialog("Add a new file", @ScriptDir, "All (*.*)",1+4)
$count = StringSplit($open, "|")
For $i = 2 To $count[0]
IniWrite(@ScriptDir & "\temp_dat.ini","Files",$i,$count[$i])
Next
IniWrite(@ScriptDir & "\temp_dat.ini","Path","Path",$count[1])
FileSetAttrib(@ScriptDir & "\temp_dat.ini","+RT")
GUICtrlSetData($list1, $open)
EndFunc
;Func _change()
; $read1 = GUICtrlRead($text)
; $read2 = GUICtrlRead($counter)
; $read3 = GUICtrlRead($type)
; $read4 = GUICtrlRead($datetimecheck)
; $read5 = GUICtrlRead($settingscheck)
; $read6 = GUICtrlRead($datetimecombo)
; $read7 = GUICtrlRead($settingscombo)
; $read8 = IniReadSection(@scriptdir & "\temp_dat.ini", "Files")
; $read9 = IniRead(@scriptdir & "\temp_dat.ini", "Path","Path","")
; For $i = 2 To $read8[0][0]
; $readini = IniRead(@scriptdir & "\temp_dat.ini", "Files",$read8[0][$i],"")
; StringSplit($readini,".")
; If $read1 <> "" Or "Text" Then
; If $read2 <> "" Or "Counter" Then
; If $read3 <> "" Or "Type" Then
; FileMove($read9 & "\" & $readini,$read9 & "\" & $read1 & $read2+1 & "." & $read3,1)
; EndIf
; EndIf
; EndIf
; Next
;EndFunc
Func _resetlist()
GUICtrlSetData($list1, "")
FileDelete(@ScriptDir & "\temp_dat.ini")
EndFunc
Func _help()
MsgBox(0, "Help","Activated Tips on the GUI")
GUICtrlSetTip($list1,"Your loaded files and the path")
GUICtrlSetTip($loadbutton,"Loads new files")
GUICtrlSetTip($resetbutton,"Clears the list and deletes the temporary data file")
GUICtrlSetTip($text,"Write your file name in here")
GUICtrlSetTip($counter,"This adds a number to your file name" & @CRLF & "If you don't want that leave it blank" & @CRLF & "The number increases automatically with every file")
GUICtrlSetTip($type,"This sets a new file type" & @CRLF & "Just write something like mp3 (you don't need the .) in" & @CRLF & "Leave it blank if you don't want the file type changed" )
GUICtrlSetTip($datetimecheck,"Choose if you want Date, Time or both as the file name")
GUICtrlSetTip($settingscheck,"Choose if you want to load preset Settings")
GUICtrlSetTip($savebutton,"Save your current Settings as preset Settings")
GUICtrlSetTip($resetsettingsbutton,"Clears Text, Counter, Type and Checkboxes")
GUICtrlSetTip($changebutton,"Changes your file")
EndFunc
Scripte können nach belieben benutzt werden.
Bitte helft mir, ich sitz da teilweise seit knapp 20h dran xD
EDIT: 38 Views und keiner will/kann mir helfen? Q_Q
EDIT2: 50... wo sind nAno, shadow & Co?






