BrettF Posted January 21, 2007 Share Posted January 21, 2007 Im makeing me (Yet another) media player How can i set the data of a slider so that its the position of the music and make the slider track able to seek the song. I've had a search and in the helpfile i found _soundpos and _soundlength but i counldnt find a way of making it work. Oh and did i mention, the sliders backwards? My code: expandcollapse popup#include <GUIConstants.au3> #include <Xskin.au3> #include <Sound.au3> Global $hFile $Skin_Folder = @ScriptDir & "\Blue-Gray" $Form1 = XskinGUICreate("AForm1", 536, 520,$Skin_Folder) $Group1 = GUICtrlCreateGroup("Currently Playing: ", 32, 48, 465, 73) $Label1 = GUICtrlCreateLabel("ALabel1", 48, 72, 43, 17) $Label2 = GUICtrlCreateLabel("ALabel2", 48, 96, 43, 17) $Group2 = GUICtrlCreateGroup("Controls: ", 32, 128, 465, 161) $Slider1 = GUICtrlCreateSlider(40, 144, 446, 45, BitOR($TBS_BOTH,$TBS_NOTICKS,$TBS_Left)) $Button1 = GUICtrlCreateButton("Play", 168, 200, 75, 25, 0) $Slider2 = GUICtrlCreateSlider(40, 192, 30, 93,$TBS_VERT) GUICtrlSetLimit ($Slider2, 100,0) $Button2 = GUICtrlCreateButton("Previous", 168, 232, 75, 25, 0) $Button3 = GUICtrlCreateButton("Next", 248, 232, 75, 25, 0) $Button4 = GUICtrlCreateButton("Stop", 248, 200, 75, 25, 0) $Group3 = GUICtrlCreateGroup("Playlist", 32, 296, 465, 177) $Button5 = GUICtrlCreateButton("Add File", 440, 320, 49, 25, 0) $List1 = GUICtrlCreateList("", 40, 312, 393, 149) $Button6 = GUICtrlCreateButton("Close", 440, 432, 49, 25, 0) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE OR $msg = $Button6 Then Exit ElseIf $msg = $Label1 Then ElseIf $msg = $Label2 Then ElseIf $msg = $Slider1 Then ElseIf $msg = $Button1 Then ElseIf $msg = $Slider2 Then ElseIf $msg = $Button2 Then MsgBox(0,"slider1",100 - GUICtrlRead($slider2)) ElseIf $msg = $Button3 Then ElseIf $msg = $Button4 Then ElseIf $msg = $Button5 Then $hFile = FileOpenDialog ("Open", "", "MP3 Files (*.MP3)") AdlibEnable ( "Adlibfunc") GUICtrlSetData ($Label1,_SoundLength ($hFile)) SoundPlay ($hFile) ElseIf $msg = $List1 Then EndIf WEnd Func AdLibFunc () $volume = 100 - GUICtrlRead($slider2) SoundSetWaveVolume ($volume) GUICtrlSetData ($Label2, _SoundLength ($hFile), ":")_SoundPos ($hFile)) GUICtrlSetLimit ($Slider1,StringSplit (_SoundLength ($hFile), ":")) GUICtrlSetData ($Slider1, StringSplit (_SoundPos ($hFile), ":")) EndFunc Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Danny35d Posted January 22, 2007 Share Posted January 22, 2007 expandcollapse popup#include <GUIConstants.au3> #include <Xskin.au3> #include <Sound.au3> Global $hFile, $Sound $Skin_Folder = @ScriptDir & "\skins\Blue-Gray" $Form1 = XskinGUICreate("AForm1", 536, 520,$Skin_Folder) $Group1 = GUICtrlCreateGroup("Currently Playing: ", 32, 48, 465, 73) $Label1 = GUICtrlCreateLabel("Time", 48, 72, 43, 17) $Label2 = GUICtrlCreateLabel("Song", 48, 96, 400, 17) $Group2 = GUICtrlCreateGroup("Controls: ", 32, 128, 465, 161) $Slider1 = GUICtrlCreateSlider(40, 144, 446, 45, BitOR($TBS_BOTH,$TBS_NOTICKS,$TBS_Left)) GUICtrlSetLimit ($Slider1, 100, 1) $Button1 = GUICtrlCreateButton("Play", 168, 200, 75, 25, 0) $Slider2 = GUICtrlCreateSlider(40, 192, 30, 93,$TBS_VERT) GUICtrlSetLimit ($Slider2, 100,0) $Button2 = GUICtrlCreateButton("Previous", 168, 232, 75, 25, 0) $Button3 = GUICtrlCreateButton("Next", 248, 232, 75, 25, 0) $Button4 = GUICtrlCreateButton("Stop", 248, 200, 75, 25, 0) $Group3 = GUICtrlCreateGroup("Playlist", 32, 296, 465, 177) $Button5 = GUICtrlCreateButton("Add File", 440, 320, 49, 25, 0) $List1 = GUICtrlCreateList("", 40, 312, 393, 149) $Button6 = GUICtrlCreateButton("Close", 440, 432, 49, 25, 0) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE OR $msg = $Button6 Then Exit ElseIf $msg = $Label1 Then ElseIf $msg = $Label2 Then ElseIf $msg = $Slider1 Then ElseIf $msg = $Button1 Then ElseIf $msg = $Slider2 Then ElseIf $msg = $Button2 Then MsgBox(0,"slider1",100 - GUICtrlRead($slider2)) ElseIf $msg = $Button3 Then ElseIf $msg = $Button4 Then ElseIf $msg = $Button5 Then $hFile = FileOpenDialog ("Open", "", "MP3 Files (*.MP3)") $FileSelected = StringSplit($hFile, '\') AdlibEnable ( "Adlibfunc") GUICtrlSetData ($Label2, $FileSelected[$FileSelected[0]]) GUICtrlSetData ($Label1, _SoundLength ($hFile)) $Sound = _SoundOpen($hFile) _SoundPlay($Sound) ElseIf $msg = $List1 Then EndIf WEnd Func AdLibFunc () Local $Pos = Int((_SoundPos($Sound, 2) / _SoundLength($Sound, 2)) * 100) $volume = 100 - GUICtrlRead($slider2) SoundSetWaveVolume ($volume) GUICtrlSetData($Label1, _SoundPos($Sound)) GUICtrlSetData ($Slider1, $Pos) EndFunc AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
BrettF Posted January 22, 2007 Author Share Posted January 22, 2007 Thankyou. I'll see if i can get it to seek.... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now