Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

[Pytanie] Odtwarzacz .mp3 brak pomysłu


Rekomendowane odpowiedzi

Opublikowano

hotkey u mnie działają nawet gdy okno jest zminimalizowane.
może ktoś to potwierdzić ?

F8 - Back
F9 - Play/Stop
F10 - Start/Pause
F11 - Next
END - Exit

 

Ver. do testów :)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <sound.au3>
#include <SliderConstants.au3>
#include <File.au3>
HotKeySet("{F9}", "Playstop")
HotKeySet("{F10}", "StartPause")
HotKeySet("{F11}", "next1")
HotKeySet("{F8}", "Back")
HotKeySet("{END}", "wyjscie")
Global $Sound, $Sound1, $File1, $volume3
Global $s2, $s, $s3, $B, $h
$volume=True
$volume2=True
$plynie=True
$s4=-1
$Random = True
$Rep=True
$next = True
$back = True


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Amfiproject", 390, 350, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 40, 22, 310, 70)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("...", 20, 22, 20, 20)
$Button2 = GUICtrlCreateButton("Play", 40, 100, 145, 97, $BS_ICON)
$Button4= GUICtrlCreateButton("Pause", 205, 100, 145, 97)
$Button6= GUICtrlCreateButton(">>>>", 205, 200, 145, 97)
$Button7= GUICtrlCreateButton("<<<<", 40, 200, 145, 97)
$Slider1 = GUICtrlCreateSlider(40, 50, 280, 25)
$Label2 = GUICtrlCreateLabel("100%", 320, 51, 30, 25)
$Radio1 = GUICtrlCreateRadio("Random", 215, 315, 70, 17)
$Radio2 = GUICtrlCreateRadio("Repeats", 130, 315, 70, 17)
$Radio3 = GUICtrlCreateRadio("Normal", 50, 315, 70, 17)
GUICtrlSetState($radio3, $GUI_CHECKED)
$Labe2 = GUICtrlCreateLabel("##", 47, 5,15,15)
$Labe3 = GUICtrlCreateLabel("##",  80, 5,10,15)
$Labe4 = GUICtrlCreateLabel(" /",  65, 5,10,15)
$Labe5 = GUICtrlCreateLabel("00:00:00",  250, 5,50,15)
$Labe6 = GUICtrlCreateLabel("stoped",  300, 5,50,15)
$Checkbox1 = GUICtrlCreateCheckbox("Mute", 300, 315, 97, 17)
GUICtrlSetData($Slider1, 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;-----------------------------------------------------------------------------@

$Folder = FileSelectFolder("Wybierz folder.", "", 2)
$szukaj = FileFindFirstFile($Folder & "\*.mp3")
$FileList = _FileListToArray($Folder,"*.mp3")
global $s2 = $FileList[0]
$s=0

While 1
         $file = FileFindNextFile($szukaj)
         If @error then ExitLoop

            GUICtrlSetData($Combo1, $file)
			WEnd


		$FileList = _FileListToArray($Folder,"*.mp3")
$s2 = $FileList[0]
FileClose($szukaj)


FileClose($szukaj)
;------------------------------------------------------------------------------@

While 1

$nMsg = GUIGetMsg()
$stats = _SoundStatus($Sound1)

;------------------------SliderVolume---------------
If $volume = True then
$B = GUICtrlRead($Slider1)
SoundSetWaveVolume($
GUICtrlSetData($Label2, $B &"%")
EndIf
;--------------------Mute----------------------------
If $volume = false then
$B = 0
SoundSetWaveVolume($
GUICtrlSetData($Label2, $B &"%")
GUICtrlSetData($Slider1, $


EndIf
if $plynie = True And $stats = "stopped" And $Random = True And $Rep = True Then
next1()
	EndIf
if $plynie = True And $stats = "stopped" And $Random = False And $Rep = True Then
$s = Random(1,$s2,1)
 next1()
EndIf
if $plynie = True And $stats = "stopped" And $Random = True And $Rep = False Then
Play()
EndIf
If 1=1 then

    $soundpos = _SoundPos($Sound1)
	GUICtrlSetData($Labe6,$stats)
    GUICtrlSetData($Labe5,$soundpos)
	GUICtrlSetData($Labe2,$s&"   z ")
	GUICtrlSetData($Labe3,$s2)
	sleep(5)
	EndIf

	Switch $nMsg
		case $Checkbox1
			if $volume2 = true Then
				$volume = false
				$volume2 = False
				$volume3 = $B

			Else
				$volume = true
				$volume2 = True
				GUICtrlSetData($Slider1, $volume3)
				EndIf
		Case $GUI_EVENT_CLOSE
			wyjscie()

		case $Button1
			Find()
		case $Combo1
			play()
			$plynie = True
		case $Button2

			Playstop()
		Case $Button4
			StartPause()

		Case $Radio1
			$Random=False
            $Rep=True
	    Case $Radio2
	       $Rep = False
		   $Random=True
	   Case $radio3
		   $Rep = True
		   $Random=True
		Case $Button6
		   next1()

	   case $Button7
		   Back()


	EndSwitch

	WEnd
Func PLAY12()
	GUICtrlSetData($Combo1, $Filelist[$s])
	play()
	endfunc
func random1()

endfunc
func play()
	_SoundStop($Sound1)
	$Sound = GUICtrlRead($Combo1)
			$Sound1 = $Folder & "\" & $Sound
			_SoundPlay($Sound1,0)
		EndFunc
func next1()
	$plynie = True
	GUICtrlSetData($Button4, "Pause")
	GUICtrlSetData($Button2, "Stop")
if $Rep = True Then
If $s=$s2 then
	$s=0
EndIf
	$s+=1
if $s<$s2 And $Random = True then
			GUICtrlSetData($Combo1, $Filelist[$s])

			play()

			$back=False



EndIf
if $Random = False then
	$s = Random(1,$s2,1)
	GUICtrlSetData($Combo1, $Filelist[$s])
	play()
	EndIf
EndIf



EndFunc

;------------------------------ErrorFuncBack__Gdy wchodzi na 0 w liscie pojawia sie ilosc piosenek;;;;TAJEMNICZALICZBA:)-------------------;
func Back()
	$plynie = True
	GUICtrlSetData($Button4, "Pause")
	GUICtrlSetData($Button2, "Stop")

if $Rep = True then


$s-=1
if $s>0 And $Random = True then
	GUICtrlSetData($Combo1, $FileList[$s])
			play()
		Else
			$s = $s2
			GUICtrlSetData($Combo1, $FileList[$s])
			play()
		EndIf

if $Random = False then
	$s = Random(1,$s2,1)
	GUICtrlSetData($Combo1, $Filelist[$s])

	play()
EndIf

	Endif

		EndFunc
;----------------------------------Reset $Label i zmiennej $s  --------------------------;
func Find()
GUICtrlSetData($Labe2, "##")
GUICtrlSetData($Labe3, "##")
GUICtrlSetData($Combo1, $s3)
$s=1
	$Folder = FileSelectFolder("Wybierz folder.", "", 2)
$szukaj = FileFindFirstFile($Folder & "\*.mp3")

      While 1
         $file = FileFindNextFile($szukaj)
         If @error then ExitLoop
            GUICtrlSetData($Combo1, $file)

		WEnd
		$FileList = _FileListToArray($Folder,"*.mp3")


$s2 = $FileList[0]
FileClose($szukaj)
	EndFunc

	;---------------------------Dodany warunek $ha=GUICtrlRead($Button2)
	;IF $ha = "Stop" then
	;-----------------------------------------------------------------
Func StartPause()
	$ha=GUICtrlRead($Button2)
	IF $ha = "Stop" then
	$hams=GUICtrlRead($Button4)
if $hams = "Pause" then
	GUICtrlSetData($Button4, "Continue...")
	Pause()
	EndIf
	If $hams = "Continue..." Then
	GUICtrlSetData($Button4, "Pause")

	resume()

	EndIf
endif

EndFunc
func resume()
	_SoundResume($Sound1)
	endfunc
Func Pause()

	_SoundPause($Sound1)
EndFunc
Func Playstop()
GUICtrlSetData($Button4,"Pause")
		$hams2=GUICtrlRead($Button2)
if $hams2 = "Play" then
	GUICtrlSetData($Button2, "Stop")
	$plynie = True
	PLAY12()

	EndIf
	If $hams2 = "Stop" Then
	GUICtrlSetData($Button2, "Play")
	_SoundStop($Sound1)
	$plynie = False

	EndIf

	endfunc

	Func wyjscie()
	Exit
EndFunc

v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
 

Opublikowano
$FileList = _FileListToArray($Folder,"*.mp3")
global $s2 = $FileList[0]

 

 

A co jeśli zbiór będzie pusty? $czypusty = (uBound( $FileList ) = 0)

Hotkeye działają, ładnie zrobione.

 

Poszerz trochę ten label:

68f2f3dfdb.png

WSZYSTKIE PLIKI W CHMURZE DLA MPCFORUM ZOSTAŁY USUNIĘTE. NIE KORZYSTAĆ Z MOICH PROGRAMÓW.

Proszę nie ingerować w moje posty/tematy, w razie potrzeby usunąć całą zawartość. Nie pomagam.

Opublikowano

Tamto chwilowo jest zawieszone :)
Nie wiem czy coś jeszcze robiłem w tym ale trzymajcie ostatnią wersje

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIListView.au3>
#include <sound.au3>
#include <SliderConstants.au3>
#include <File.au3>
HotKeySet("{F9}", "Playstop")
HotKeySet("{F10}", "StartPause")
HotKeySet("{F11}", "next1")
HotKeySet("{F8}", "Back")
HotKeySet("{END}", "wyjscie")
Global $Sound, $Sound1, $File1, $volume3
Global $s2, $s, $s3, $B, $h
$volume=True
$volume2=True
$plynie=True
$s4=-1
$Random = True
$Rep=True
$next = True
$back = True


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Amfiproject", 390, 350, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 40, 22, 310, 70)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("...", 20, 22, 20, 20)
$Button2 = GUICtrlCreateButton("Play", 40, 100, 145, 97, $BS_ICON)
$Button4= GUICtrlCreateButton("Pause", 205, 100, 145, 97)
$Button6= GUICtrlCreateButton(">>>>", 205, 200, 145, 97)
$Button7= GUICtrlCreateButton("<<<<", 40, 200, 145, 97)
$Slider1 = GUICtrlCreateSlider(40, 50, 280, 25)
$Label2 = GUICtrlCreateLabel("100%", 320, 51, 30, 25)
$Radio1 = GUICtrlCreateRadio("Random", 215, 315, 70, 17)
$Radio2 = GUICtrlCreateRadio("Repeats", 130, 315, 70, 17)
$Radio3 = GUICtrlCreateRadio("Normal", 50, 315, 70, 17)
GUICtrlSetState($radio3, $GUI_CHECKED)
$Labe2 = GUICtrlCreateLabel("##", 47, 5,15,15)
$Labe3 = GUICtrlCreateLabel("##",  80, 5,10,15)
$Labe4 = GUICtrlCreateLabel(" /",  65, 5,10,15)
$Labe5 = GUICtrlCreateLabel("00:00:00",  250, 5,50,15)
$Labe6 = GUICtrlCreateLabel("stoped",  300, 5,50,15)
$Checkbox1 = GUICtrlCreateCheckbox("Mute", 300, 315, 97, 17)
GUICtrlSetData($Slider1, 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;-----------------------------------------------------------------------------@

$Folder = FileSelectFolder("Wybierz folder.", "", 2)
$szukaj = FileFindFirstFile($Folder & "\*.mp3")
$FileList = _FileListToArray($Folder,"*.mp3")
global $s2 = $FileList[0]
$s=0

While 1
         $file = FileFindNextFile($szukaj)
         If @error then ExitLoop

            GUICtrlSetData($Combo1, $file)
			WEnd


		$FileList = _FileListToArray($Folder,"*.mp3")
$s2 = $FileList[0]
FileClose($szukaj)


FileClose($szukaj)
;------------------------------------------------------------------------------@

While 1

$nMsg = GUIGetMsg()
$stats = _SoundStatus($Sound1)

;------------------------SliderVolume---------------
If $volume = True then
$B = GUICtrlRead($Slider1)
SoundSetWaveVolume($
GUICtrlSetData($Label2, $B &"%")
EndIf
;--------------------Mute----------------------------
If $volume = false then
$B = 0
SoundSetWaveVolume($
GUICtrlSetData($Label2, $B &"%")
GUICtrlSetData($Slider1, $


EndIf
if $plynie = True And $stats = "stopped" And $Random = True And $Rep = True Then
next1()
	EndIf
if $plynie = True And $stats = "stopped" And $Random = False And $Rep = True Then
$s = Random(1,$s2,1)
 next1()
EndIf
if $plynie = True And $stats = "stopped" And $Random = True And $Rep = False Then
Play()
EndIf
If 1=1 then

    $soundpos = _SoundPos($Sound1)
	GUICtrlSetData($Labe6,$stats)
    GUICtrlSetData($Labe5,$soundpos)
	GUICtrlSetData($Labe2,$s&"   z ")
	GUICtrlSetData($Labe3,$s2)
	sleep(5)
	EndIf

	Switch $nMsg
		case $Checkbox1
			if $volume2 = true Then
				$volume = false
				$volume2 = False
				$volume3 = $B

			Else
				$volume = true
				$volume2 = True
				GUICtrlSetData($Slider1, $volume3)
				EndIf
		Case $GUI_EVENT_CLOSE
			wyjscie()

		case $Button1
			Find()
		case $Combo1
			play()
			$plynie = True
		case $Button2

			Playstop()
		Case $Button4
			StartPause()

		Case $Radio1
			$Random=False
            $Rep=True
	    Case $Radio2
	       $Rep = False
		   $Random=True
	   Case $radio3
		   $Rep = True
		   $Random=True
		Case $Button6
		   next1()

	   case $Button7
		   Back()


	EndSwitch

	WEnd
Func PLAY12()
	GUICtrlSetData($Combo1, $Filelist[$s])
	play()
	endfunc
func random1()

endfunc
func play()
	_SoundStop($Sound1)
	$Sound = GUICtrlRead($Combo1)
			$Sound1 = $Folder & "\" & $Sound
			_SoundPlay($Sound1,0)
		EndFunc
func next1()
	$plynie = True
	GUICtrlSetData($Button4, "Pause")
	GUICtrlSetData($Button2, "Stop")
if $Rep = True Then
If $s=$s2 then
	$s=0
EndIf
	$s+=1
if $s<$s2 And $Random = True then
			GUICtrlSetData($Combo1, $Filelist[$s])

			play()

			$back=False



EndIf
if $Random = False then
	$s = Random(1,$s2,1)
	GUICtrlSetData($Combo1, $Filelist[$s])
	play()
	EndIf
EndIf



EndFunc

;------------------------------ErrorFuncBack__Gdy wchodzi na 0 w liscie pojawia sie ilosc piosenek;;;;TAJEMNICZALICZBA:)-------------------;
func Back()
	$plynie = True
	GUICtrlSetData($Button4, "Pause")
	GUICtrlSetData($Button2, "Stop")

if $Rep = True then


$s-=1
if $s>0 And $Random = True then
	GUICtrlSetData($Combo1, $FileList[$s])
			play()
		Else
			$s = $s2
			GUICtrlSetData($Combo1, $FileList[$s])
			play()
		EndIf

if $Random = False then
	$s = Random(1,$s2,1)
	GUICtrlSetData($Combo1, $Filelist[$s])

	play()
EndIf

	Endif

		EndFunc
;----------------------------------Reset $Label i zmiennej $s  --------------------------;
func Find()
GUICtrlSetData($Labe2, "##")
GUICtrlSetData($Labe3, "##")
GUICtrlSetData($Combo1, $s3)
$s=1
	$Folder = FileSelectFolder("Wybierz folder.", "", 2)
$szukaj = FileFindFirstFile($Folder & "\*.mp3")

      While 1
         $file = FileFindNextFile($szukaj)
         If @error then ExitLoop
            GUICtrlSetData($Combo1, $file)

		WEnd
		$FileList = _FileListToArray($Folder,"*.mp3")


$s2 = $FileList[0]
FileClose($szukaj)
	EndFunc

	;---------------------------Dodany warunek $ha=GUICtrlRead($Button2)
	;IF $ha = "Stop" then
	;-----------------------------------------------------------------
Func StartPause()
	$ha=GUICtrlRead($Button2)
	IF $ha = "Stop" then
	$hams=GUICtrlRead($Button4)
if $hams = "Pause" then
	GUICtrlSetData($Button4, "Continue...")
	Pause()
	EndIf
	If $hams = "Continue..." Then
	GUICtrlSetData($Button4, "Pause")

	resume()

	EndIf
endif

EndFunc
func resume()
	_SoundResume($Sound1)
	endfunc
Func Pause()

	_SoundPause($Sound1)
EndFunc
Func Playstop()
GUICtrlSetData($Button4,"Pause")
		$hams2=GUICtrlRead($Button2)
if $hams2 = "Play" then
	GUICtrlSetData($Button2, "Stop")
	$plynie = True
	PLAY12()

	EndIf
	If $hams2 = "Stop" Then
	GUICtrlSetData($Button2, "Play")
	_SoundStop($Sound1)
	$plynie = False

	EndIf

	endfunc

	Func wyjscie()
	Exit
EndFunc

Chwilowo zawieszone się znaczy że doskonale playliste bo to jest jedyny problem tutaj :)
Niedzielna praca

Playlist

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>
#include <File.au3>
IniDelete("Playlist.ini","sound")
IniWrite("Playlist.ini","sound", "","")
global $Ilosc, $pack , $Ilosc2
$Ilosc=0
Dim $Song[1000]
Dim $Song2[1000]
$pack2=true
$Firstload=True
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 219, 541, 252, 145, BitOR($GUI_SS_DEFAULT_GUI,$WS_THICKFRAME))
$List1 = GUICtrlCreateList("", 0, 0, 225, 525,BitOR($LBS_NOTIFY,$WS_BORDER,$WS_VSCROLL)) ;;;$LBS_MULTIPLESEL


$Button1 = GUICtrlCreateButton("Add", 16, 520, 49, 17, $BS_NOTIFY)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Delate", 88, 520, 49, 17, $BS_NOTIFY)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("Tester", 152, 520, 49, 17, $BS_NOTIFY)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			wyjscie()
		case $Button1
			Find()
		Case $Button2
			  If Not GUICtrlRead($List1) = "" Then

			 $fyy = _GUICtrlListBox_FindInText($List1, GUICtrlRead($List1))
              MsgBox(0,"",$fyy)
			_GUICtrlListBox_DeleteString($List1, $fyy)
			_ArrayDelete($Song2,$fyy)
		EndIf



			 case $Button3
				 _ArrayDisplay($Song2, "Tablica:]")
				; GUICtrlSetstate($List1,

				 ;String $fyy
				;Playlist()
	EndSwitch
WEnd

func Find()
	if $Firstload = true then
$Folder = FileSelectFolder("Wybierz folder.", "", 2)
if @error Then
		Switch MsgBox(4,"","Czy napewno chcesz zakonczyc?")
			case 6
				wyjscie()

			case 7
				Find()
				EndSwitch

EndIf


$Ilosc2=$Ilosc
 $Ilosc3=$Ilosc-1


			$FileList = _FileListToArray($Folder,"*.mp3")
			if @Error=4 Then
			MsgBox(0,"Error","Brak plików *.mp3 w podanym katalogu.")
			Find()
EndIf
	    $Ilosc = $FileList[0]
		$Ilosc=$Ilosc+$Ilosc2
					For $Ilosc2 = $Ilosc2 To $Ilosc-1
					$idx=$Ilosc2-$Ilosc3
						$Song[$Ilosc2]=$Folder&"\"&$FileList[$idx]
						$Song2[$Ilosc2]=$FileList[$idx]
						Guictrlsetdata($List1,$Song2[$Ilosc2])
next
$Ilosc2=$Ilosc
$Firstload = false
EndIf

      endfunc

	  Func Playlist()
		  endfunc

Func wyjscie()
	Exit
EndFunc

Usuwanie z listy działa :)
Dodawanie chwilowo jednorazowe :)
Tester porównanie z tablica :)
Czekam na sugestie :)
Ogólnie krytyka też się przyda :)
Mimo że to mój 4 lub 5 dzień z tym :)

v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
 

Opublikowano

v1 chyba proste;)
v2 to projekt dopiero:) właściwie playlista tylko;)
już troszkę dalej jestem ale to wszystko jutro. ;)



do v.1 dodalem progressbar przed wyjsciem:)

 

 

 

 

 

@Edit

Dobra bo Playlist prawie skończyłem:)
Pytania:
-Czy da się dodać pojedynczy plik w stylu "Fileselectfolder", tylko nie folder lecz jeden ewentualnie 2-6-345345? :D Taka sytuacja :)

-Czy myślicie że dało by się przesuwać pliki na liście ?
-Jak miałbym wczytać dane z pliku ini by zapisać je na tablice ?:)

kod:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>
#include <File.au3>
#include <ProgressConstants.au3>
global $IL1, $pack , $IL4
Global $Clean, $LI4, $List1
$Ilosc=0
$Ilosc3=$Ilosc
Dim $Song[1000]
Dim $Song2[1000]
$pack2=true
$Firstload=True


iniwrite("Player.ini","key","1","nice")


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AmfiProject", 219, 560, 252, 145, BitOR($GUI_SS_DEFAULT_GUI,$WS_THICKFRAME))
$List1 = GUICtrlCreateList("", 0, 0, 225, 525,BitOR($LBS_NOTIFY,$WS_BORDER,$WS_VSCROLL,$LBS_MULTIPLESEL))


$Button1 = GUICtrlCreateButton("Add", 16, 520, 49, 17, $BS_NOTIFY)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Delate", 88, 520, 49, 17, $BS_NOTIFY)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("Tab1", 152, 520, 49, 17, $BS_NOTIFY)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button4 = GUICtrlCreateButton("Tab2", 152, 540, 49, 17, $BS_NOTIFY)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit 1
		case $Button1
			Find()
		Case $Button2
			  Delete()




			 case $Button3
				 _ArrayDisplay($Song2, "Tablica:]")
			case $Button4
               _ArrayDisplay($Song, "Tablica2:]")
	EndSwitch
WEnd

func Find()
	IF $Firstload = True Then
		$Folder = FileSelectFolder("Wybierz folder.", "", 2)
		$FileList = _FileListToArray($Folder,"*.mp3")
		$IL1 = $FileList[0]
		$IL4=$IL1
$IL2=0
$IL3=0-1
			For $IL2=$IL2 to $IL1 -1
				$idx=$Il2-$IL3
			$Song[$IL2]=$Folder&"\"&$FileList[$idx]
			$Song2[$IL2]=$FileList[$idx]
		next
Listreview()
	Else
		$Folder = FileSelectFolder("Wybierz folder.", "", 2)
		$FileList = _FileListToArray($Folder,"*.mp3")
		$IL1 = $FileList[0]
		$IL5=$IL4
		$IL6=$IL1+$IL4
		$IL7=$IL5
	    $IL7=$IL7-1
			For $IL5 = $IL5 to $IL6 -1
			$idx=$IL5-$IL7
			$Song[$IL5]=$Folder&"\"&$FileList[$idx]
			$Song2[$IL5]=$FileList[$idx]
			Guictrlsetdata($List1,$Song2[$IL5])
			next
		$IL4=$IL6
		Listreview()


	EndIf
	$Firstload = False
endfunc
Func Listreview()
	Guictrlsetdata($List1,$Clean)
	$inir1=$IL4-1
		$inir=0

		For $inir=0 to $inir1
			$inir3=$inir+1
			$Resultinir =$Song2[$inir]
			$Resultinir2 =$Song[$inir]
				Guictrlsetdata($List1,$inir3&" - "&$Resultinir)
				Iniwrite("Player.ini", "Value", "" ,$IL4)
				Iniwrite("Player.ini", "Song", $inir ,$Resultinir)
				Iniwrite("Player.ini", "Folder", $inir ,$Resultinir2)
			next
	endfunc
Func Delete()
		  If Not GUICtrlRead($List1) = "" Then

			 $fyy = _GUICtrlListBox_FindInText($List1, GUICtrlRead($List1))
;~               MsgBox(0,"",$fyy)
			_ArrayDelete($Song2,$fyy)
			_ArrayDelete($Song,$fyy)
			$IL4=$IL4-1
			Listreview()
		EndIf

		  endfunc
Func wyjscie()
	exit 1
EndFunc

v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
 

Opublikowano

1.

d66c9f12d6.png

Za options daj 5 (4 + 1).

 

2. Musisz wyłączyć sortowanie alfabetyczne.

Dodaj gdzieś nad stworzeniem listoboxa:

 

Global $LBS_NOTIFY = 0x1, $WS_VSCROLL = 0x200000, $WS_BORDER = 0x800000;

 

Potem do tego to:

http://www.autoitscript.com/forum/topic/61942-guictrllistview-moveitems-udf/ 

 

3.

 



Local $count = IniRead("inipath", "sekcja", "songcount", 0)
if not $count Then 
	;couldnt find any song
endIf


Local $array[ $count + 1 ]
for $i = 0 to $count
	$array[ $i ] = IniRead("inipath", "sekcja", "song" & $i, "0" )
next

WSZYSTKIE PLIKI W CHMURZE DLA MPCFORUM ZOSTAŁY USUNIĘTE. NIE KORZYSTAĆ Z MOICH PROGRAMÓW.

Proszę nie ingerować w moje posty/tematy, w razie potrzeby usunąć całą zawartość. Nie pomagam.

Opublikowano

No Dobra :)
Pogubiłem się w tamtym więc jeżeli masz chęć udzielić mi pomocy trochę Ci to też postaram ułatwić,
Więc zacznijmy od początku :)

Nie patrz chwilowo na działania poszczególnych funkcji. Są one niedokończone ale główny mechanizm działa więc kontynuuje.
Dodawanie folderów sprawne.
Teraz mam problem z dodaniem wybranych plików. A mianowicie stoję na tym:
Łap

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Array.au3>
#include <File.au3>
Global $Pliki, $Folder, $Pliki2
Global $Ilosc,$Ilosc2,$Ilosc3
Dim $Playtab[300][3]
dim $Pliki2[100][3]
$FirstLoad = true
$loaderror = False
#Region ### START Koda GUI section ### Form=
$Playlist = GUICreate("Form1", 255, 410, 200, 187, BitOR($GUI_SS_DEFAULT_GUI,$WS_THICKFRAME))
$List1 = GUICtrlCreateListview("Nr.|Song", 0, 0, 255, 375)
$Btadd = GUICtrlCreateButton("ADD", 10, 380, 30, 25)
$Btdel = GUICtrlCreateButton("REM", 50, 380, 30, 25)
$Bttest = GUICtrlCreateButton("TST", 90, 380, 30, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
	$nMsg = GUIGetMsg()



	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $Btadd
			SelectFolder()
		Case $Btdel
             LoadFile()
		Case $Bttest
			_ArrayDisplay($Playtab,"1")
			_ArrayDisplay($Pliki2,"2")
	EndSwitch
WEnd
;--------------------AllFunc-----------------------AllFunc---------------------@
;--------AllFunc--------------------AllFunc---------------------AllFunc--------@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;--------------------------------------------------SelectFolder----------------@
Func SelectFolder()
	while 1
$Folder = FileSelectFolder("Wybierz folder.", "", 2)
$Pliki = _FileListToArray($Folder,"*.mp3")
	if @error then
    msgBox(0,"Error","Brak '*.mp3' w podanym katalogu.")
	SelectFolder()
	ExitLoop
endif
$Ilosc2 = $Pliki[0]
If $Firstload=true then
	FirstLoad()
Else
	NextLoad()
	endif
$loaderror=False
ExitLoop
wend
endfunc
;---------------------------------------------------EndSelectFolder------------;@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;---------------------------------------------------FirstLoad------------------;@
Func FirstLoad()
		for $i1 = 0 to $Ilosc2
			$Playtab[$i1][0] = $Folder
			$Playtab[$i1][1] = $Pliki[$i1]
		next
		$FirstLoad = false
		$Ilosc3=$Ilosc2
		ListReviev()
	    MsgBox(0,"","FirstLoad")
	EndFunc
;----------------------------------------------EndFirstload	-------------------;@																		   ;@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;-----------------------------------------------NextLoad-----------------------;@
Func NextLoad()
	$il3 = $Ilosc3+1
	$il4=$il3-1
	$Ilosc = $Ilosc2 + $Ilosc3
			for $il3=$il3 to $Ilosc
		$idx=$il3-$il4
		$Playtab[$il3][0] = $Folder
		$Playtab[$il3][1] = $Pliki[$Idx]
		$Playtab[0][1] = $Ilosc
next
$Ilosc3=$Ilosc
ListReviev()
MsgBox(0,"","NextLoad")
	endfunc
;-----------------------------------------------EndNextLoad--------------------@
;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;-----------------------------------------------ListReviev---------------------@
func ListReviev()

;To raczej wiem jak zrobić więc zostaje w takim stanie 
endfunc


;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Error 
;Tu pojawia się problem 
;Jak miałbym rozdzielić ciąg znaków ?
;oddzielić folder od plików ?
;i plik od pliku ?
func LoadFile()
	$Pliki1 = FileOpenDialog("Wybierz pliki", @DesktopDir, "(*.mp3)", 1 + 4)
	$Pliki1 = StringReplace($Pliki1, "|", @CRLF)
	MsgBox(0,"",$Pliki1)
	endfunc


Po wielu próbach stworzenia poważnej listy odpuszczam możliwość przesuwania plików :/

FileOpenDialog dalej jest zagadką

Zarys nowego odtwarzacza :)
Jakieś propozycje ?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <ProgressConstants.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#include <File.au3>
#include <sound.au3>
Dim $tab[1000][2]
global $Ilosc, $Ilosclog,$sound
$IL4=0
$q7=0
$nextload=true
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Player", 277, 465, 460, 429, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME), BitOR($WS_EX_APPWINDOW,$WS_EX_RIGHT,$WS_EX_WINDOWEDGE))
$btback = GUICtrlCreateButton("<<", 16, 88, 25, 25, BitOR($BS_LEFT,$BS_NOTIFY))
GUICtrlSetFont(-1, 11, 800, 0, "Impact")
$btplay = GUICtrlCreateButton(">", 40, 88, 25, 25)
GUICtrlSetFont(-1, 11, 800, 2, "Impact")
$btpause = GUICtrlCreateButton("\\", 64, 88, 25, 25)
GUICtrlSetFont(-1, 11, 800, 2, "Impact")
$btstop = GUICtrlCreateButton("t", 88, 88, 25, 25)
GUICtrlSetFont(-1, 48, 800, 0, "Impact")
$btnext = GUICtrlCreateButton(">>", 112, 88, 25, 25)
GUICtrlSetFont(-1, 11, 800, 2, "Impact")
$bdadd = GUICtrlCreateButton("ADD", 16, 120, 33, 25)
GUICtrlSetFont(-1, 11, 400, 0, "Impact")
$btdel = GUICtrlCreateButton("Del", 56, 120, 33, 25)
GUICtrlSetFont(-1, 11, 400, 0, "Impact")
$testl = GUICtrlCreateButton("test", 100, 120, 33, 25)
$List1 = GUICtrlCreateList("", 0, 144, 277, 321,BitOR($GUI_DOCKAUTO,$LBS_NOTIFY = 0x1,$WS_BORDER= 0x800000,$WS_VSCROLL = 0x200000))
$Label1 = GUICtrlCreateLabel("########################", 16, 16, 250, 26)
$Progress1 = GUICtrlCreateProgress(16, 48, 241, 25)
$Slider1 = GUICtrlCreateSlider(144, 88, 113, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###







While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		case $bdadd
			Find()
		Case $List1
			$readp1=GUICtrlRead($List1)
			GUICtrlSetData($Label1, $readp1)
		Case $btdel
			Delete()
		case $btplay
			Play()
Case $testl
	_ArrayDisplay($tab)
	EndSwitch
WEnd


Func Find()
$Folder = FileSelectFolder("Wybierz folder.", "", 2)
		$FileList = _FileListToArray($Folder,"*.mp3")
		$IL1 = $FileList[0]
		$IL5=$IL4
		$IL6=$IL1+$IL4
		$IL7=$IL5

		if $nextload = True Then
			;$Ilosclog=$IL1
			 $Ilosclog=$il6
			$IL7=$IL7
			$nextload = False
		Else
			 $IL7=$IL7-1
			 $IL6-=1
			 $Ilosclog=$il6
			 endif
		For $IL5 = $IL5 to $IL6
			$idx=$IL5-$IL7
			$tab[$Il5][0]=$Folder&"\"&$FileList[$idx]
			$tab[$Il5][1]=$FileList[$idx]
		next
$IL4=$IL6+1
MsgBox(0,"",$Ilosclog)
Listreview()
EndFunc

Func Listreview()
	$Clean=""
	Guictrlsetdata($List1,$Clean)
	$inir1=$IL4-1
		$inir=0

		For $inir=1 to $inir1
			$inir3=$inir
			$Resultinir =$tab[$inir][1]
			$Resultinir2 =$tab[$inir][0]
				Guictrlsetdata($List1,$inir3&" - "&$Resultinir)
				Iniwrite("Player.ini", "Value", "" ,$IL4)
				Iniwrite("Player.ini", "Song", $inir ,$Resultinir)
				Iniwrite("Player.ini", "Folder", $inir ,$Resultinir2)
			next
	endfunc

Func Delete()
		  If Not GUICtrlRead($List1) = "" Then

			 $fyy = _GUICtrlListBox_FindInText($List1, GUICtrlRead($List1))
			 $fyy+=1
;~ 			MsgBox(0,"",$fyy)
			_ArrayDelete($tab,$fyy)

			$IL4=$IL4-1
			Listreview()
		EndIf

		  endfunc
			func play()
			_SoundStop($Sound)
			If $q7 = $Ilosclog Then
				$q7=0
				EndIf
			$q7+=1
			$Sound=$tab[$q7][0]
			_SoundPlay($Sound,0)
		endfunc
		
		

v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v^v
 

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...