kann mir mal jemand ein beispiel/anweisung geben wie ich eine playliste mit drag_drop machen kann ich kriegs zum verrecken nicht hin
v.g.
JuraX
playliste erstellen
-
- [ offen ]
-
JuraX -
19. Januar 2010 um 21:53 -
Geschlossen -
Erledigt
-
-
Hallo JuraX,
such einmal im Forum Skripte nach Starplayer von Oscar , er benutzt darin Drag' and Drop in einer Listview
mfg (Auto)Bert
-
ich hab das gefunden er nimmt aber kein D'aD an
Spoiler anzeigen
[autoit]Global $gaDropFiles[1]
[/autoit] [autoit][/autoit] [autoit]
Global Const $WM_DROPFILES = 0x0233
$hGui = GUICreate('Listview Drag & Drop', 640, 480, -1, 0, Default, $WS_EX_ACCEPTFILES) ; $WS_EX_ACCEPTFILES als Extended Style
$hListView = GUICtrlCreateListView('Dateiname', 10, 10, 620, 400)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; Control als Drop-Control einrichten
GUISetState()
GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
WinSetOnTop($hGui, '', 1)While True
[/autoit] [autoit][/autoit] [autoit]
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_DROPPED
For $i = 0 To UBound($gaDropFiles) - 1
GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1'), $hListView)
_GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
Next
EndSwitch
WEndFunc WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
[/autoit]
Local $nSize, $pFileName
Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)
For $i = 0 To $nAmt[0] - 1
$nSize = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', 0, 'int', 0)
$nSize = $nSize[0] + 1
$pFileName = DllStructCreate('wchar[' & $nSize & ']')
DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', DllStructGetPtr($pFileName), 'int', $nSize)
ReDim $gaDropFiles[$i + 1]
$gaDropFiles[$i] = DllStructGetData($pFileName, 1)
$pFileName = 0
Next
EndFunc ;==>WM_DROPFILES_FUNC -
- Offizieller Beitrag
Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
Global $gaDropFiles[1]
Global Const $WM_DROPFILES = 0x0233
$hGui = GUICreate('Listview Drag & Drop', 640, 480, -1, 0, Default, $WS_EX_ACCEPTFILES) ; $WS_EX_ACCEPTFILES als Extended Style
$hListView = GUICtrlCreateListView('Dateiname', 10, 10, 620, 400)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; Control als Drop-Control einrichten
GUISetState()
GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
WinSetOnTop($hGui, '', 1)While True
[/autoit] [autoit][/autoit] [autoit]
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_DROPPED
For $i = 0 To UBound($gaDropFiles) - 1
GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1'), $hListView)
_GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
Next
EndSwitch
WEndFunc WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
[/autoit]
Local $nSize, $pFileName
Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)
For $i = 0 To $nAmt[0] - 1
$nSize = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', 0, 'int', 0)
$nSize = $nSize[0] + 1
$pFileName = DllStructCreate('wchar[' & $nSize & ']')
DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', DllStructGetPtr($pFileName), 'int', $nSize)
ReDim $gaDropFiles[$i + 1]
$gaDropFiles[$i] = DllStructGetData($pFileName, 1)
$pFileName = 0
Next
EndFunc ;==>WM_DROPFILES_FUNCDie Includes haben gefehlt. Das Beispiel funzt bei mir einwandfrei.
-
das funktioniert schon mal aber wießo eingebunden nicht mehr?
Spoiler anzeigen
[autoit]Local $progress_slider ,$slots, $Form1
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
#NoTrayIcon
#include <Bass.au3>
#include <BassConstants.au3>
#include <GUIConstantsEx.au3>
#Include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <sound.au3>
#include <WindowsConstants.au3>Global $gaDropFiles[1]
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Global Const $WM_DROPFILES = 0x0233Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam) ; diese Funktion wird benötigt, damit man auch mehrere Dateien droppen kann
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Local $nSize, $pFileName
Local $nAmt = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', 0xFFFFFFFF, 'ptr', 0, 'int', 255)
For $i = 0 To $nAmt[0] - 1
$nSize = DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', 0, 'int', 0)
$nSize = $nSize[0] + 1
$pFileName = DllStructCreate('wchar[' & $nSize & ']')
DllCall('shell32.dll', 'int', 'DragQueryFileW', 'hwnd', $wParam, 'int', $i, 'ptr', DllStructGetPtr($pFileName), 'int', $nSize)
ReDim $gaDropFiles[$i + 1]
$gaDropFiles[$i] = DllStructGetData($pFileName, 1)
$pFileName = 0
Next
EndFunc
Func Aktualisieren()
$Sliderstatus = GUICtrlRead($progress_slider)
GUICtrlSetData($slots, $Sliderstatus)
EndFunc
Func _BASS_ChannelSetVolume($hChannel, $nVol)
Local $ret = _BASS_ChannelSetAttribute($hChannel,$BASS_ATTRIB_VOL,$nVol)
Return SetError(@error,@extended,$ret)
EndFunc
Func _BASS_ChannelGetVolume($hChannel)
Local $ret = _BASS_ChannelGetAttribute($hChannel,$BASS_ATTRIB_VOL)
Return SetError(@error,@extended,$ret)
EndFuncAdLibRegister("Aktualisieren", 100)
[/autoit] [autoit][/autoit] [autoit]
$firststart = IniRead("INRadio.ini","Start","firststart","");If $firststart = "" Then
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
; MsgBox(0,"Warnung!","Bitte über den Radiotuner Starten!")
; Exit
;ElseIf ProcessExists( "Radiotuner.exe" ) then
;Else
;MsgBox(0,"Warnung!","Bitte über den Radiotuner Starten!")
; Exit
;EndIfGlobal $playing_state = -1
[/autoit] [autoit][/autoit] [autoit]
;Open Bass.DLL. Required for all function calls.
_BASS_STARTUP ("BASS.dll");Initalize bass. Required for most functions.
[/autoit] [autoit][/autoit] [autoit]
_BASS_Init (0, -1, 44100, 0, "");Check if bass iniated. If not, we cannot continue.
[/autoit] [autoit][/autoit] [autoit]
If @error Then
MsgBox(0, "Error", "Could not initialize audio")
Exit
EndIf;Prompt the user to select a MP3 file
[/autoit] [autoit][/autoit] [autoit]
$file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)");Create a stream from that file.
[/autoit] [autoit][/autoit] [autoit]
$MusicHandle = _BASS_StreamCreateFile (False, $file, 0, 0, 0);Check if we opened the file correctly.
[/autoit] [autoit][/autoit] [autoit]
If @error Then
MsgBox(0, "Error", "Could not load audio file" & @CR & "Error = " & @error)
Exit
EndIf;Create GUI and controls
[/autoit] [autoit][/autoit] [autoit]
$Form1 = GUICreate("INRadio-Localtuner", 380, 450, 193, 115)
$progress_slider = GUICtrlCreateProgress(8, 32, 366, 20)
$Volume_slider1 = GUICtrlCreateSlider(8,210,366,80)
$Volume_slider2 = GUICtrlCreateSlider(8,292,366,80)
GUICtrlSetLimit(-1,100,0)
GUICtrlSetData($Volume_Slider1,50)
GUICtrlSetData($Volume_Slider2,50)
GUICtrlCreateLabel("Lautstärke",8,190,80,20)
GUICtrlSetLimit(-1, 100, 0)
$hListView = GUICtrlCreateListView('Dateiname', 10, 375, 150, 200)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; Control als Drop-Control einrichten
GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC')
WinSetOnTop($Form1, '', 1)
$rightVol = GUICtrlCreateProgress(8, 88, 366, 17)
GUICtrlSetLimit(-1, 100, 0)
$LeftVol = GUICtrlCreateProgress(8, 136, 366, 17)
GUICtrlSetLimit(-1, 100, 0)
$slots = GUICtrlCreateLabel(GUICtrlRead($progress_slider)& "%",8, 8, 150, 17)
;GUICtrlCreateLabel("Fortschritt", 8, 8, 150, 17)
GUICtrlCreateLabel("Right Channel Volume Level", 8, 112, 150, 17)
GUICtrlCreateLabel("Left Channel Volume Level", 8, 64, 150, 17)
$Close = GUICtrlCreateButton("Close", 296, 160, 75, 25, 0)
$Play_pause = GUICtrlCreateButton("Play", 216, 160, 75, 25, 0)
$Stop = GUICtrlCreateButton("Stop", 136, 160, 75, 25, 0)
$newfile = GUICtrlCreateButton("Andere Datei", 36, 160, 75, 25, 0)
;Show GUI
GUISetState(@SW_SHOW);Get the length of the song in bytes.
[/autoit] [autoit][/autoit] [autoit]
$song_length = _BASS_ChannelGetLength ($MusicHandle, $BASS_POS_BYTE)While 1
[/autoit] [autoit][/autoit] [autoit]
;Get Current playback position
$current = _BASS_ChannelGetPosition ($MusicHandle, $BASS_POS_BYTE)
;Calculate the percentage
$percent = Round(($current / $song_length) * 100, 0)
;Set the slider to show percent
GUICtrlSetData($progress_slider, $percent);Get Right/Left Playback Levels
[/autoit] [autoit][/autoit] [autoit]
$levels = _BASS_ChannelGetLevel ($MusicHandle)
;Get Right and calculate percentage
$rightChLvl = _LoWord ($levels)
$rightChLvlper = Round(($rightChLvl / 32768) * 100, 0)
;Get Left and calculate percentage
$LeftChLvl = _HiWord ($levels)
$leftChLvlper = Round(($LeftChLvl / 32768) * 100, 0)
;Set the levels on GUI.
GUICtrlSetData($rightVol, $rightChLvlper)
GUICtrlSetData($LeftVol, $leftChLvlper);Get GUI Message
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
;If Close button or red x, then exit. Alway remember to free resources
Case $GUI_EVENT_CLOSE, $Close
ProcessClose("Radiotuner.exe")
AdLibUnRegister("Aktualisieren")
Exit
Case $Play_pause
;Check if playing or paused, then take appropriate action
Switch $playing_state
Case - 1 ; Song stopped, start from begining.
;Play Song
_BASS_ChannelPlay ($MusicHandle, 1)
$playing_state = 1
EndSwitch
Case $newfile
_BASS_ChannelStop ($MusicHandle)
$file = FileOpenDialog("Open...", "", "MP3 Files (*.mp3)")
$MusicHandle = _BASS_StreamCreateFile (False, $file, 0, 0, 0)
_BASS_ChannelStop ($MusicHandle)
Case $Volume_slider1
_BASS_ChannelSetVolume($MusicHandle, GUICtrlRead($Volume_slider1) / 100)
Case $volume_slider2
SoundSetWaveVolume(GUICtrlRead($Volume_Slider2))
Case $GUI_EVENT_DROPPED
For $i = 0 To UBound($gaDropFiles) - 1
GUICtrlCreateListViewItem(StringRegExpReplace($gaDropFiles[$i], '.*\\(.*)\..*', '$1'), $hListView)
_GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE)
Case $Stop
;Stop Song
_BASS_ChannelStop ($MusicHandle)
$playing_state = -1
EndSwitch
WEndIf $progress_slider =100 Then
[/autoit] [autoit][/autoit] [autoit]
$play_pause
EndIfFunc OnAutoItExit()
[/autoit]
;Free Resources
_BASS_Free()
EndFunc ;= -
GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC') vergessen?
Nimms mir nicht übel, aber einfach Skripte zusammenkopieren wird dich langfristig nicht ans Ziel bringen.
-
- Offizieller Beitrag
GUIRegisterMsg($WM_DROPFILES, 'WM_DROPFILES_FUNC') vergessen?
Nimms mir nicht übel, aber einfach Skripte zusammenkopieren wird dich langfristig nicht ans Ziel bringen.
Schau mal in Zeile 94.
Das Script ist aber so dermaßen durcheinenadergeschafft, das man nirgends mehr durchblickt. -
Ok daran lags nicht.
JuraX vielleiht hilft es schon dein Skript etwas "aufzuräumen"
Includes -> Deklaration & Wertzuweisung der Variablen (Gui usw.) -> While Wend Schleife -> Funktionen
So ca. -
der fehler war z167 da hat ein next gefehlt