Login Register






[AutoIt]Simple media player filter_list
Author
Message
[AutoIt]Simple media player #1
Code:
#include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <Sound.au3> ;by 1234hotmaster Global $Fpath = FileOpenDialog("Select Audio file",@WorkingDir,"Sound Files(*.mp3;*.wav)|All Files(*.*)") Global $Playing = False Global $SoundHwnd If Not @error Then $SoundHwnd = _SoundOpen($Fpath) If Not @error Then $MPlayer = GUICreate("Music Player Sample", 243,40, -1, -1, BitOR($GUI_SS_DEFAULT_GUI,$WS_SIZEBOX,$WS_THICKFRAME), BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetBkColor(0x000000) $BACK = GUICtrlCreateButton("<<", 44, 8, 35, 25, BitOR($BS_FLAT,$WS_BORDER)) $STOP = GUICtrlCreateButton("[¯]", 84, 8, 35, 25, BitOR($BS_FLAT,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 4, "Arial") $PLAYORPAUSE = GUICtrlCreateButton("l>", 124, 8, 35, 25, BitOR($BS_FLAT,$WS_BORDER)) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetTip(-1, "By 1234hotmaster") $FORWARD = GUICtrlCreateButton(">>", 164, 8, 35, 25, BitOR($BS_FLAT,$WS_BORDER)) GUISetState(@SW_SHOW) _SoundPlay($SoundHwnd) $Playing = True GUICtrlSetData($PLAYORPAUSE,"||") While 1 Switch GUIGetMsg() Case -3 _SoundClose($SoundHwnd) Exit Case $PLAYORPAUSE If Not $Playing Then _SoundPlay($SoundHwnd) GUICtrlSetData($PLAYORPAUSE,"||") $Playing = True ElseIf $Playing Then _SoundPause($SoundHwnd) GUICtrlSetData($PLAYORPAUSE,"l>") $Playing = False EndIf Case $BACK If $Playing Then $HMS = StringSplit(_SoundPos($SoundHwnd,1),":") If IsArray($HMS) Then _SoundPause($SoundHwnd) _SoundSeek($SoundHwnd,$HMS[1],$HMS[2],$HMS[3]-10) _SoundPlay($SoundHwnd) EndIf EndIf Case $FORWARD If $Playing Then $HMS = StringSplit(_SoundPos($SoundHwnd,1),":") If IsArray($HMS) Then _SoundPause($SoundHwnd) _SoundSeek($SoundHwnd,$HMS[1],$HMS[2],$HMS[3]+10) _SoundPlay($SoundHwnd) EndIf EndIf Case $STOP GUICtrlSetData($PLAYORPAUSE,"l>") _SoundStop($SoundHwnd) EndSwitch WinSetTitle(WinGetHandle($MPlayer),"Music Player Sample",_SoundPos($SoundHwnd,1) & " / " & _SoundLength($SoundHwnd,1)) If _SoundPos($SoundHwnd,1) >= _SoundLength($SoundHwnd,1) Then Sleep(500) _SoundPlay($SoundHwnd) EndIf WEnd EndIf
Pierce the life fibers with your drill.

Reply

RE: [AutoIt]Simple media player #2
Nice. I Need Some Help. I Know How to use FileOpenDialog but If i Wanted to Make a Text Editor, How Would i Get the Text from a Text File to Open in $var = GUICtrlCreateEdit(...)? Would i Have to Grab data from the Control Using GUICtrlRead($var)?

Reply

RE: [AutoIt]Simple media player #3
Code:
FileRead("C:\example.txt")

You mean like this? Smile

Edit: If there is any other question please post a thread Thank You.
(This post was last modified: 11-15-2011, 12:55 AM by Skullmeat.)
Pierce the life fibers with your drill.

Reply

RE: [AutoIt]Simple media player #4
good post pl keep posting nice tricks

Reply