AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help With AHK Media Player +

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
happytodd



Joined: 12 Nov 2007
Posts: 83
Location: South Australia

PostPosted: Sat Apr 26, 2008 1:57 pm    Post subject: Help With AHK Media Player + Reply with quote

Dear users,
I am currently making a personal version of AHK media player that Frys made. Heres my script:
Code:
#SingleInstance ignore

FileInstall, SoundFunctions.ahk, SoundFunctions.ahk, 0
SetBatchLines -1
#NoEnv
SetTimer, UpdateTime,100
SetTimer,UpdateProgress,1000
SetTimer,CheckStatus,100
SoundGet, MV
RSound := Round(MV)
playing = 0
; Create the main Edit control and display the window:
Gui, +Resize  ; Make the window resizable.
Gui, Add, Edit, vMainEdit WantTab W300 R10
Gui, Show,, Eclipze Media Player
CurrentFileName =  ; Indicate that there is no current file.
Gui, Add, StatusBar, x176 y70 w290 h30 , Not Playing A File
Gui, Add, Button, x16 y60 w290 h20 gOpenMF, Select Media File
Gui, Add, Button, x210 y80 w80 h20 gStopF, Stop
Gui, Add, Button, x130 y80 w80 h20 gPauseF, Pause
Gui, Add, Button, x50 y80 w80 h20 gResumeF, Resume
Gui, Add, Progress, x16 y20 w290 h30 cBlue vProgress Range1-100 vProgress, 0
Gui, Add, Text, x16 y250 w290 h30 vSongTime, 0:0:0 of 0:0:0
; Generated using SmartGUI Creator 4.0
Loop, %A_MyDocuments%\*.*
    LV_Add("", A_LoopFileName, A_LoopFileSizeMB, A_LoopFileExt,A_LoopFileFullPath)
LV_ModifyCol()
LV_ModifyCol(2,"Integer")
return

GuiSize:
if ErrorLevel = 1  ; The window has been minimized.  No action needed.
    return
; Otherwise, the window has been resized or maximized. Resize the Edit control to match.
GuiControl, Move, MainEdit, W%NewWidth% H%NewHeight%
return

VolumeC:
Gui, Submit, NoHide
SoundSet,%VSlider%,master
GuiControl,, VText,Volume`:%VSlider%
Return
;Sound Controls

OpenMF:
CheckSong := Sound_Status(hSound)
If CheckSong = playing
    {
    Sound_Stop(hSound)
    playing = 0
    }
Gui, +OwnDialogs
FileSelectFile, Filetoplay, 3, , Select Media File,
If Filetoplay =
    msgbox,No File Selected

filename=
sleep 100
SplitPath, Filetoplay, filename
sleep 100

hSound := Sound_Open(Filetoplay)
If Not hSound
   return
playing = 1
Sound_Play(hSound)
Guicontrol,,Progress,0
Guicontrol,% "+Range1-" Sound_Length(hSound) / 1000,Progress
SplitPath, Filetoplay, filename
SB_SetText("Now Playing " filename)
return

StopF:
Sound_Stop(hSound)
playing = 0
Guicontrol,,Progress,0
GuiControl,,SongTime,0:0:0 of 0:0:0
SB_SetText("Not Playing A File")
return

PauseF:
Sound_Pause(hSound)
return

ResumeF:
Sound_Resume(hSound)
return

UpdateTime:
If playing = 0
      return
If(Sound_Pos(hSound) = Sound_Length(hSound))
      return
GuiControl,,SongTime,% Tohhmmss(Sound_Pos(hSound)) .  " of "  . Tohhmmss(Sound_Length(hSound))
return


UpdateProgress:
If playing = 0
      return
If(Sound_Pos(hSound) = Sound_Length(hSound))
      return
Guicontrol,,Progress,% (Sound_Pos(hSound) / 1000)
Return

CheckStatus:
Status := Sound_Status(hSound)
If Status = stopped
    {
    sleep 1500
    Guicontrol,,Progress,0
    Guicontrol,,SongTime,0:0:0 of 0:0:0
    SB_SetText("Not Playing A File")
    }
return


PlayLV:
LV_GetText(filetoplaylv, A_EventInfo, 4)
CheckSong := Sound_Status(hSound)
If CheckSong = playing
    {
    Sound_Stop(hSound)
    playing = 0
    }   
hSound := Sound_Open(filetoplaylv)
If Not hSound
   return
playing = 1
Sound_Play(hSound)
Guicontrol,,Progress,0
Guicontrol,% "+Range1-" Sound_Length(hSound) / 1000,Progress
SplitPath, filetoplaylv, filenamelv
SB_SetText("Now Playing " filenamelv)
return

UpdateLV:
Gui, Submit, NoHide
LV_Delete()
Loop, %Directory%\*.*
    LV_Add("", A_LoopFileName, A_LoopFileSizeMB, A_LoopFileExt,A_LoopFileFullPath)
LV_ModifyCol()
LV_ModifyCol(2,"Integer")
return

#Include SoundFunctions.ahk

Now I have some problems with it. Like when you open it up it has a black line top left corner. I believe I still have a textbox hidden somewhere there as I built it off of one of my other scripts. Another thing is I don't want it too be resizable if someone can fix that up for me. Yet 1 more thing I would like is when you close the program down I would like it too leave the task bar please. Thanks guys!
_________________

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group