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

[Problem] z INIWRITE


Amfetaminek

Rekomendowane odpowiedzi

Opublikowano

Kontynuując mój odtwarzacz pomyślałem sobie iż dam mu pamięć playlisty
Jaki napotkał mnie problem


_arraydisplay macie do wglądu pod random :D

Kod za chwilę
A problem wygląda tak:
Funkcja Listreviev() Usuwa wszystko z ini
Później wpisuje od nowa.
Ok sprawne ale niestety tylko przy wyborze przycisku URL co wydaje się być debilne albo coś niedowidzę dziś :D[

Z góry dzięki :)

#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,$so1
Global $Folder, $prog , $sect
$ini1=IniRead("Player.ini","Value","","")
$tab[0][0]=$ini1
for $ini =1 to $ini1
	$tab[$ini][0]=IniRead("Player.ini","Folder", $ini,"")
	$tab[$ini][1]=IniRead("Player.ini","Song", $ini,"")
next
if not $tab[0][0] =""  Then $IL4=$tab[0][0]
$ini=true
if $tab[0][0] ="" then
$IL4=0
$ini = false
endif
$q7=1
$nextload=true
$fol1=True
$listactive = True
AdlibRegister("vol")
$start=false
$normalmode = True
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AmfiPlayer", 277, 465, 460, 429, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME), BitOR($WS_EX_APPWINDOW,$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")
$bturl = GUICtrlCreateButton("URL", 56, 120, 33, 25)
GUICtrlSetFont(-1, 11, 400, 0, "Impact")
$btdel = GUICtrlCreateButton("DEL", 100, 120, 33, 25)
GUICtrlSetFont(-1, 11, 400, 0, "Impact")
$random = GUICtrlCreateCheckbox("Random", 150, 120, 55, 15)
$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,BitOR($GUI_SS_DEFAULT_SLIDER,$TBS_TOP))
GUICtrlSetData($Slider1, 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###







While 1
	$nMsg = GUIGetMsg()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;IF $ini = True then
;Listreview()
;$ini=False
;endif
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Listreview()
			Exit
		case $bdadd
			$fol1=false
			Find()
		Case $List1
			$listactive = True
			$readp1=GUICtrlRead($List1)
			$fyy2 = _GUICtrlListBox_FindInText($List1, GUICtrlRead($List1))
			$q7=$fyy2+1
		Case $btdel
			Delete()
		case $btplay
			Play()
	    case $btstop
			_SoundStop($Sound)
			AdlibUnRegister("prog")
			GUICtrlSetData($Progress1,0)
			$prog=0
		case $btpause
			_SoundPause($sound)
			AdlibUnRegister("prog")
		Case $btback
				back1()
		Case $btnext
                 next1()
		case $bturl
			$fol1=true
			Find()
			Case $random
		    _ArrayDisplay($tab)

	EndSwitch
WEnd

Func Find()
	while 1
		_SoundStop($Sound)
		$Folder=""
	If $fol1 = true then
    $Folder = FileSelectFolder("Wybierz folder.", "", 2)
	If @error=1 then
     $lll = MsgBox(4,"Error","Exit?")
	  Switch $lll
		case 6
			Exit
		case 7
			MsgBox(4096, "", "No File(s) chosen")
			EndSwitch
  else
	  $FileList = _FileListToArray($Folder,"*.mp3")
	  if @error=1 Then
		 MsgBox(4096, "", "No File(s) chosen")
	  Else
		$f=$IL4
		$f1 =  $FileList[0]
        for $f5=1 to $f1
		$sound=$Filelist[$f5]
		$Folder2=$Folder&"\"&$sound
		$f+=1
		$tab[$f][0]=$Folder2
		$tab[$f][1]=$sound
	next
	$IL4=$IL4+$f1
	$tab[0][0]=$IL4
		  endif
endif

		else
$var = FileOpenDialog("", @DesktopDir & "", "(*.mp3)",5 )
If @error Then
	MsgBox(4096, "", "No File(s) chosen")
Else
	Local $arr = StringSplit($var, '|', 1)
if $arr[0] = 1 Then
	$t3=$IL4
	$t3+=1
	$Folder=""
	$tekst=$arr[1]
	$arr = StringSplit($var, '\',1 )
	$Folder= $Folder&$arr[1]
	for $t1=2 to $arr[0]
	$Folder=$Folder&"\"&$arr[$t1]
next

$soundone=$arr[$arr[0]]
$tab[$t3][0]=$Folder
$tab[$t3][1]=$soundone
$IL4+=1
$Tab[0][0]=$IL4

$Folder=""
else
$Folder=$arr[1]
$t3=$IL4
$ts=$arr[0]
for $t5=2 to $ts
$sound22=$arr[$t5]
$t3+=1
$tab[$t3][0]=$Folder&"\"&$sound22
$tab[$t3][1]=$sound22
	next
	$IL4=$t3
	$Tab[0][0]=$IL4

endif
EndIf
EndIf

$start=True
ExitLoop
WEnd
Listreview()
EndFunc

Func Listreview()
	$inir=0
	$Clean=""
	IniDelete("Player.ini","Value")
	IniDelete("Player.ini","Song")
	IniDelete("Player.ini","Folder")
	Guictrlsetdata($List1,$Clean)

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

Func Delete()
	Guictrlsetdata($Label1,"###############")
	        AdlibUnRegister("prog")
			GUICtrlSetData($Progress1,0)
	_SoundStop($Sound)
		  If Not GUICtrlRead($List1) = "" Then

			 $fyy = _GUICtrlListBox_FindInText($List1, GUICtrlRead($List1))
			 $fyy+=1
			_ArrayDelete($tab,$fyy)
if $IL4>0 then
	$start=false
			$IL4=$IL4-1
			endif
			$Tab[0][0]=$IL4

			Listreview()
		EndIf

		  endfunc




			func play()
				If $start = true then
					$q7+=1
				If $listactive=true then
					_SoundStop($Sound)
				endif
				$listactive=False
				$so1=_SoundStatus($sound)
				If $so1 = "paused" Then
					_SoundResume($sound)
					AdlibRegister( "prog",$sect)
					endif
				If $so1 = "stopped" then
			_SoundStop($Sound)
			$Sound=$tab[$q7][0]
			Guictrlsetdata($Label1, $tab[$q7][1])
			_SoundPlay($Sound,0)
			readprog()
			endif
		endif

		endfunc
func next1()
	If $start = true then
	$so1=_SoundStatus($sound)
	if $q7 = $tab[0][0] then
				$q7=0
			endif
	if $q7 < $tab[0][0] and $so1="playing" Then
				$q7+=1
				_SoundStop($Sound)
			play()
		endif

			EndIf
EndFunc
func back1()
	If $start = true then
	$so1=_SoundStatus($sound)
	if $so1="playing" Then
	if $q7 = 1 Then
		$q7=$tab[0][0]
				else
				$q7-=1
			EndIf
			_SoundStop($Sound)
			play()
		EndIf
		EndIf
	EndFunc

		Func vol()
			$slid=GUICtrlRead($Slider1)
			SoundSetWaveVolume( $slid )

		endfunc


func readprog()
	GUICtrlSetData($Progress1,0)
	$sect=""
	$prog=0
	$so1=_SoundStatus($sound)
	If $so1="playing" then
$sect=_SoundLength($Sound,2)
$sect=$sect/1000
$sect=$sect/100*1000
AdlibRegister("prog",$sect)
EndIf
endfunc


		func prog()
			$prog = $prog+ 1
GUICtrlSetData($Progress1, $prog)
			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ę...