I have finally fixed it
CODE#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.2.0
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <GuiConstants.au3>
#include <Sound.au3>
global $pl1 = 0
global $media = 0
$g1 = GuiCreate("Mp3 Player v4", 335, 125,-1, -1)
GUISetFont(10, "", "", "Times New Roman")
TraySetState(2)
;; MAIN
$play = GUICtrlCreateButton("Play", 5, 50, 50, 20)
$stop = GUICtrlCreateButton("Stop", 5, 72, 50, 20)
$select = GUICtrlCreateButton("Select", 5, 94, 50, 20)
$pause = GUICtrlCreateButton("Pause", 5, 28, 50, 20)
$e1 = GUICtrlCreateInput("", 100, 50, 200, 20, $ES_READONLY)
$sl = GUICtrlCreateSlider(100, 100, 200)
GUICtrlCreateLabel("Volume", 180, 80)
GUICtrlCreateLabel("Selected Song", 160, 20)
GUICtrlSetData($sl, 100)
Func slider()
SoundSetWaveVolume( GUICtrlRead( $sl ) )
EndFunc
GuiSetState()
While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
SoundSetWaveVolume(100)
ExitLoop
Case $msg = $play
_SoundPlay($Media)
SoundSetWaveVolume(100)
Case $msg = $stop
_SoundStop($Media)
Case $msg = $pause
_SoundPause($Media)
Case $msg = $select
_SoundStop($Media)
$File=FileOpenDialog("","","Media files (*.avi;*.mp3;*.wav;*.mpg)")
$Media=_SoundOpen($File)
$mid = $File
while 1
$songstr = stringinstr($mid,"\")
if $songstr = 0 then ExitLoop
$mid = stringmid($mid,$songstr+1)
wend
$sk = $mid
GUICtrlSetData($e1, $sk)
Case $msg = $sl
Call("slider")
Case Else
EndSelect
WEnd
Exit
I also removed the tray Icon because I don't like it
AND made some other changes
*Created a slidebar for sound control
*Added some labels
*Created a pause button
Hope you'll like it