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 

Music player. Need some help with back and pause

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



Joined: 09 Jun 2008
Posts: 936
Location: Canada

PostPosted: Fri Jan 02, 2009 3:47 am    Post subject: Music player. Need some help with back and pause Reply with quote

Code:







Gui, Add, ListView, r20 y10 w650 gMyListView1

vlistview1, Name|Size

(KB)|Modified|Created|Accessed|Attributes|Full  ; SONGS

(1)

;

////////////////////////////////////////////////////////

/SCANNER////////////////////////////////////////////////

/////////////////////

Loop, C:\*.mp3, 0, 1
{
Gui, ListView, listview1
Lv_Add("", A_LoopFileName,

A_LoopFileSizeKB,A_LoopFileTimeModified,

A_LoopFileTimeCreated, A_LoopFileTimeAccessed,

A_LoopFileAttrib, A_LoopFileFullPath)
LV_ModifyCol()  ; Auto-size each column to fit its

contents.
}
   
;

////////////////////////////////////////////////////////

/SCRIPT/////////////////////////////////////////////////

////////////////////
 

Gui, Add, ListView, x700 y10 w450 R7 gMyListView2

vlistview2, Name|Size

(KB)|Modified|Created|Accessed|Attributes|Full   ;

PLAYLIST (2)
Gui, Add, Edit, vsearch gfind x700 y240 w300,
Gui, Add, Button, x1050 y200 gclear2, Clear All
Gui, Add, ListView, x700 y270 w500 R5 gMyListView3

vlistview3, Name|Size

(KB)|Modified|Created|Accessed|Attributes|Full  ; SEARCH

(3)
Gui, Add, Button, x952 y172 w50 h20 , Play
Gui, Add, Button, x1062 y172 w40 h20 , Stop
Gui, Add, Button, x1012 y172 w30 h20 gnext, >>
Gui, Add, Button, x912 y172 w30 h20 gprev, <<
Gui, Add, Button, x952 y202 w50 h20 , Pause
;///////////////////////////////////////////////////////

////////////////////////////////////////////////////////

//////////////
Gui, Add, Button, x662 y22 w30 h30 gmove1, >>
Gui, Add, Button, x662 y52 w30 h30 gmove2, <<
Gui, Add, Button, x662 y302 w30 h30 gmove4, <<
;///////////////////////////////////////////////////////

////////////////////////////////////////////////////////

//////////////
Gui, Add, Button, x1060 y240 gclear1, Clear All
Gui, Add, Checkbox, x1105 y172 w40 h20 vloop , Loop
Gui, Add, Slider, x782 y182 w120 h33 gSliderMove

vvolumeslider, 50
Gui, Add, Button, x742 y182 w40 h30 vmute gMute, Mute
Gui, Add, Button, x232 y392 w100 h20 greload, New Music

Folder
Gui, Show, w1200,
Menu, tray, add  ; Creates a separator line.
Menu, tray, add, Hide\Restore , MenuHandler  ; Creates a

new menu item.
return

clear1:
Gui, ListView, listview2
Loop % LV_GetCount()
{
Gui, ListView, listview2   
LV_GetText(RetrievedText, A_Index, 1)
LV_GetText(RetrievedText2, A_Index, 2)
LV_GetText(RetrievedText3, A_Index, 3)
LV_GetText(RetrievedText4, A_Index, 4)
LV_GetText(RetrievedText5, A_Index, 5)
LV_GetText(RetrievedText6, A_Index, 6)
LV_GetText(RetrievedText7, A_Index, 7)
Gui, ListView, listview1
LV_Add("",RetrievedText, RetrievedText2, RetrievedText3,

RetrievedText4, RetrievedText5, RetrievedText6,

RetrievedText7)
LV_ModifyCol()
}
Gui, ListView, listview2
Lv_Delete()
Return,

clear2:
Gui, ListView, listview3
Loop % LV_GetCount()
{
Gui, ListView, listview3   
LV_GetText(RetrievedText, A_Index, 1)
LV_GetText(RetrievedText2, A_Index, 2)
LV_GetText(RetrievedText3, A_Index, 3)
LV_GetText(RetrievedText4, A_Index, 4)
LV_GetText(RetrievedText5, A_Index, 5)
LV_GetText(RetrievedText6, A_Index, 6)
LV_GetText(RetrievedText7, A_Index, 7)
Gui, ListView, listview1
LV_Add("",RetrievedText, RetrievedText2, RetrievedText3,

RetrievedText4, RetrievedText5, RetrievedText6,

RetrievedText7)
LV_ModifyCol()
}
Gui, ListView, listview3
Lv_Delete()
Return,



move1:
Loop, 10
{
 RowNuKBer = 0  ; This causes the first loop iteration

to start the search at the top of the list.
 Loop
 {
 Gui, ListView, listview1
 RowNuKBer := LV_GetNext(RowNuKBer)  ; Resume the search

at the row after that found by the previous iteration.
     if RowNuKBer = 0
         break
     else   
     LV_GetText(RetrievedText, RowNuKBer, 1)
   LV_GetText(RetrievedText2, RowNuKBer, 2)
   LV_GetText(RetrievedText3, RowNuKBer, 3)
   LV_GetText(RetrievedText4, RowNuKBer, 4)
   LV_GetText(RetrievedText5, RowNuKBer, 5)
   LV_GetText(RetrievedText6, RowNuKBer, 6)
   LV_GetText(RetrievedText7, RowNuKBer, 7)
        LV_Delete(RowNuKBer)
     Gui, ListView, listview2
     LV_Add("",RetrievedText, RetrievedText2,

RetrievedText3, RetrievedText4, RetrievedText5,

RetrievedText6, RetrievedText7)
     LV_ModifyCol()
 }
 Sleep, 100
}
Return,


move2:
Loop, 10
{
 RowNuKBer = 0  ; This causes the first loop iteration

to start the search at the top of the list.
 Loop
 {
 Gui, ListView, listview2
 RowNuKBer := LV_GetNext(RowNuKBer)  ; Resume the search

at the row after that found by the previous iteration.
     if RowNuKBer = 0
         break
     else   
     LV_GetText(RetrievedText, RowNuKBer, 1)
   LV_GetText(RetrievedText2, RowNuKBer, 2)
   LV_GetText(RetrievedText3, RowNuKBer, 3)
   LV_GetText(RetrievedText4, RowNuKBer, 4)
   LV_GetText(RetrievedText5, RowNuKBer, 5)
   LV_GetText(RetrievedText6, RowNuKBer, 6)
   LV_GetText(RetrievedText7, RowNuKBer, 7)
     LV_Delete(RowNuKBer)
     Gui, ListView, listview1
     LV_Add("",RetrievedText, RetrievedText2,

RetrievedText3, RetrievedText4, RetrievedText5,

RetrievedText6, RetrievedText7)
     LV_ModifyCol()
  }
 Sleep, 100
}
Return,


move4:
Loop, 10
{
 RowNuKBer = 0  ; This causes the first loop iteration

to start the search at the top of the list.
 Loop
 {
 Gui, ListView, listview3
 RowNuKBer := LV_GetNext(RowNuKBer)  ; Resume the search

at the row after that found by the previous iteration.
     if RowNuKBer = 0

         break
     else   
     LV_GetText(RetrievedText, RowNuKBer, 1)
   LV_GetText(RetrievedText2, RowNuKBer, 2)
   LV_GetText(RetrievedText3, RowNuKBer, 3)
   LV_GetText(RetrievedText4, RowNuKBer, 4)
   LV_GetText(RetrievedText5, RowNuKBer, 5)
   LV_GetText(RetrievedText6, RowNuKBer, 6)
   LV_GetText(RetrievedText7, RowNuKBer, 7)
     LV_Delete(RowNuKBer)
     Gui, ListView, listview1
     LV_Add("",RetrievedText, RetrievedText2,

RetrievedText3, RetrievedText4, RetrievedText5,

RetrievedText6, RetrievedText7)
     LV_ModifyCol()
 }
 Sleep, 100
}
Return,

reload:
{
FileDelete, SpiderGames Media Player\where.txt
Reload
}

;

////////////////////////////////////////////////////////

SEARCH

ENGINE//////////////////////////////////////////////////

/////////////////

find:
Sleep, 200
ButtonSearch:
Gui, Submit, Nohide



;-------------------------------------------------------

-------CLEAR--------------------------------------------

--------------------------
Gui, ListView, listview3
Loop % LV_GetCount()
{
Gui, ListView, listview3   
LV_GetText(RetrievedText, A_Index)
LV_GetText(RetrievedText2, A_Index, 2)
  LV_GetText(RetrievedText3, A_Index, 3)
  LV_GetText(RetrievedText4, A_Index, 4)
  LV_GetText(RetrievedText5, A_Index, 5)
  LV_GetText(RetrievedText6, A_Index, 6)
  LV_GetText(RetrievedText7, A_Index, 7)
  if RetrievedText !=
   Gui, ListView, listview1
   LV_Add("",RetrievedText, RetrievedText2,

RetrievedText3, RetrievedText4, RetrievedText5,

RetrievedText6, RetrievedText7)
   LV_ModifyCol()   
}
Gui, ListView, listview3
LV_Delete()

;-------------------------------------------------------

-------ADD----------------------------------------------

------------------------

Loop, 10
{
Gui, ListView, listview1
Loop % LV_GetCount()
 {
 Gui, ListView, listview1   
LV_GetText(RetrievedText, A_Index)
LV_GetText(RetrievedText2, A_Index, 2)
LV_GetText(RetrievedText3, A_Index, 3)
LV_GetText(RetrievedText4, A_Index, 4)
LV_GetText(RetrievedText5, A_Index, 5)
LV_GetText(RetrievedText6, A_Index, 6)
LV_GetText(RetrievedText7, A_Index, 7)
   
 if RetrievedText contains %search%
     {
        Gui, ListView, listview1
   LV_Delete(A_Index)
        Sleep, 100
        Gui, ListView, listview3
        LV_Add("",RetrievedText, RetrievedText2,

RetrievedText3, RetrievedText4, RetrievedText5,

RetrievedText6, RetrievedText7)
        LV_ModifyCol() 
   }
 }
}
Return,

;

////////////////////////////////////////////////////////

END SEARCH

ENGINE//////////////////////////////////////////////////

///////////
Mute:
Gui, Submit, Nohide
GuiControl,, volumeslider, 0
SoundSetWaveVolume, 0
Return
ButtonPause:
MsgBox, Help
Return,

MenuHandler:
ifWinExist, %wintitle%
 WinClose, %wintitle%
else
 Gui, Show,, %wintitle%
Return,


SliderMove:
SoundSetWaveVolume, %volumeslider%
Return,




MyListView1:
if A_GuiEvent = DoubleClick
{
Gui, ListView, listview1
LV_GetText(RetrievedText, A_EventInfo, 1)
LV_GetText(RetrievedText2, A_EventInfo, 2)
LV_GetText(RetrievedText3, A_EventInfo, 3)
LV_GetText(RetrievedText4, A_EventInfo, 4)
LV_GetText(RetrievedText5, A_EventInfo, 5)
LV_GetText(RetrievedText6, A_EventInfo, 6)
LV_GetText(RetrievedText7, A_EventInfo, 7)
LV_Delete(A_EventInfo)
Gui, ListView, listview2
LV_Add("",RetrievedText, RetrievedText2, RetrievedText3,

RetrievedText4, RetrievedText5, RetrievedText6,

RetrievedText7)
LV_ModifyCol()
}
Return,

MyListView2:
if A_GuiEvent = DoubleClick
{
Gui, ListView, listview2
LV_GetText(RetrievedText, A_EventInfo, 1)
LV_GetText(RetrievedText2, A_EventInfo, 2)
LV_GetText(RetrievedText3, A_EventInfo, 3)
LV_GetText(RetrievedText4, A_EventInfo, 4)
LV_GetText(RetrievedText5, A_EventInfo, 5)
LV_GetText(RetrievedText6, A_EventInfo, 6)
LV_GetText(RetrievedText7, A_EventInfo, 7)
LV_Delete(A_EventInfo)
Gui, ListView, listview1
LV_Add("",RetrievedText, RetrievedText2, RetrievedText3,

RetrievedText4, RetrievedText5, RetrievedText6,

RetrievedText7)
LV_ModifyCol()
}
Return,

MyListView3:
if A_GuiEvent = DoubleClick
{
Gui, ListView, listview3
LV_GetText(RetrievedText, A_EventInfo, 1)
LV_GetText(RetrievedText2, A_EventInfo, 2)
LV_GetText(RetrievedText3, A_EventInfo, 3)
LV_GetText(RetrievedText4, A_EventInfo, 4)
LV_GetText(RetrievedText5, A_EventInfo, 5)
LV_GetText(RetrievedText6, A_EventInfo, 6)
LV_GetText(RetrievedText7, A_EventInfo, 7)
LV_Delete(A_EventInfo)
Gui, ListView, listview2
LV_Add("",RetrievedText, RetrievedText2, RetrievedText3,

RetrievedText4, RetrievedText5, RetrievedText6,

RetrievedText7)
LV_ModifyCol()
}
Return,


ButtonStop:
{
SoundPlay, Nonexistent.avi
cango = 0
Return,
}
Return,


next:
{
SoundPlay, Nonexistent.avi
}
Return,

prev:
{
MsgBox, Coming Soon
}
Return,

Restart:
ButtonPlay:
cango = 1

Gui, ListView, listview2
Loop % LV_GetCount()
{
Gui, ListView, listview2   
LV_GetText(RetrievedText, A_Index, 1)
LV_GetText(RetrievedText2, A_Index, 2)
LV_GetText(RetrievedText3, A_Index, 3)
LV_GetText(RetrievedText4, A_Index, 4)
LV_GetText(RetrievedText5, A_Index, 5)
LV_GetText(RetrievedText6, A_Index, 6)
LV_GetText(RetrievedText7, A_Index, 7)
LV_Modify(A_Index, "Select")
 if cango = 1
  {
  SoundPlay, %RetrievedText7%, WAIT
   LV_Modify(A_Index, "-Select")
  }
 else
  Break,
}
Gui, Submit, NoHide
if loop = 1
 Goto, Restart

Return,


How can i get Pause and Back to work? If you notice any other bug plz let me know.
_________________

I know i have 6 legs. It's cuz I'm special.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Neight



Joined: 31 Dec 2008
Posts: 23

PostPosted: Fri Jan 02, 2009 3:52 am    Post subject: Reply with quote

By using Sounds.ahk that fincs made. Next time, search the forums..
_________________
Ask stupid questions, get stupid answers.
Search before posting!
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 2214
Location: switzerland

PostPosted: Fri Jan 02, 2009 8:41 am    Post subject: Reply with quote

hello SpiderGames, I tried this, worked (go Backwards)
Code:
prev:
;MsgBox, Coming Soon
SoundPlay, Nonexistent.avi
  RowNumber:=LV_GetNext()
  RX:=(RowNumber)
  if (RX=1)
     {
     SoundPlay, Nonexistent.avi
     LV_Modify(1, "+Select +Focus")
     return
     }

  If (RowNumber >1)
    {
    Loop, % LV_GetCount("Column")
    LV_GetText(Col%A_Index%, RowNumber , A_Index)
    LV_Modify(RowNumber, "-Select -Focus")
    RN:=(RowNumber-1)
    LV_Modify(RN, "+Select +Focus")
    LV_GetText(C7,RN,7)
    SoundPlay,%C7%
    }
Return
Back to top
View user's profile Send private message
SpiderGames TLTLI
Guest





PostPosted: Fri Jan 02, 2009 2:21 pm    Post subject: Reply with quote

Laod wrote:
By using Sounds.ahk that fincs made. Next time, search the forums..


I did. I can't get the Souds.ahk to work.
Back to top
SpiderGames



Joined: 09 Jun 2008
Posts: 936
Location: Canada

PostPosted: Fri Jan 02, 2009 2:39 pm    Post subject: Reply with quote

garry wrote:
hello SpiderGames, I tried this, worked (go Backwards)
Code:
prev:
;MsgBox, Coming Soon
SoundPlay, Nonexistent.avi
  RowNumber:=LV_GetNext()
  RX:=(RowNumber)
  if (RX=1)
     {
     SoundPlay, Nonexistent.avi
     LV_Modify(1, "+Select +Focus")
     return
     }

  If (RowNumber >1)
    {
    Loop, % LV_GetCount("Column")
    LV_GetText(Col%A_Index%, RowNumber , A_Index)
    LV_Modify(RowNumber, "-Select -Focus")
    RN:=(RowNumber-1)
    LV_Modify(RN, "+Select +Focus")
    LV_GetText(C7,RN,7)
    SoundPlay,%C7%
    }
Return


This works pritty good. Htere is a glitch tho. if i am half way down the list. Return to the top with your method, then click next. It jumps into the middle of the list. Also if i press prev on the first song it goes to teh secnond song. This last thing however i think i can fix with % Lv_Col. It sthe jumping into th emiddle i need help with. Thanks tho
_________________

I know i have 6 legs. It's cuz I'm special.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Neight



Joined: 31 Dec 2008
Posts: 23

PostPosted: Fri Jan 02, 2009 11:11 pm    Post subject: Reply with quote

SpiderGames TLTLI wrote:
I did. I can't get the Souds.ahk to work.


If you can't get it to work, you aren't using it correctly. fincs even made an example, try again..
_________________
Ask stupid questions, get stupid answers.
Search before posting!
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 2214
Location: switzerland

PostPosted: Sat Jan 03, 2009 11:10 am    Post subject: Reply with quote

thank you for help Laod
I was lost with the different Listviews
made an example here ( see 3th example)
(MP3PLAY Listview Forward Backward Search )
http://www.autohotkey.com/forum/viewtopic.php?p=27715#27715
Back to top
View user's profile Send private message
Display posts from previous:   
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