topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 25, 2024, 4:30 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - uniuse [ switch to compact view ]

Pages: [1]
1
Update this works with the latest version of Spotify 1.0.6.80.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;|---------------|
;|--[ SOURCES ]--|
;|---------------|
;Base Spotify Script from: http://www.autohotkey.com/board/topic/36239-spotify-global-hotkeys/
;Base Starring Script from: http://superuser.com/questions/324416/any-spotify-tweaks-with-keyboard-shortcut-to-star-tracks

;|------------------|
;|--[ SETTING UP ]--|
;|------------------|
DetectHiddenWindows, On ;Detect Spotify even if it's minimized
#IfWinExist ahk_class SpotifyMainWindow ;Only do the following if Spotify is running
spotify = ahk_class SpotifyMainWindow ;Set variable for Spotify Window Name

;|---------------|
;|--[ HOTKEYS ]--|
;|---------------|
; "F5" for previous
F5::Media_Prev

; "F6" for next
F6::Media_Next

; "F4" for pause
F4::Media_Play_Pause

; "F10" for track-name
F10::
{
WinGetTitle, spotify_playing, %spotify% ;Get the title of Spotify which contains the track-name

StringTrimLeft, trimmed_playing, spotify_playing, 0 ;Get rid of extra text and place into 'trimmed_playing'
StringReplace, replaced_playing, trimmed_playing, –, -, All ;Replace en dash with normal dash and place into 'replaced_playing'

clipboard = %replaced_playing% ;Copy the fixed text to clipboard
return
}

; "F3" for volume up
F3::
{
ControlSend, ahk_parent, ^{Up}, %spotify%
return
}

; "F2 for volume down
F2::
{
ControlSend, ahk_parent, ^{Down}, %spotify%
return
}

; "F8" for vote up in Radio
F8::
{

;Store active window
        MouseGetPos, , , winID

;Left click near the song title in the "Now Playing" box.
        WinGetPos,  ,  ,  , spotifyHeight, %spotify%
        clickX := 631
        clickY := 556
        ControlClick, x%clickX% y%clickY% , %spotify%, , Left, , NA 


;Restore original window and mouse position.
        WinActivate ahk_id %winID%

        return
}

; "F7" for vote down in Radio
F7::
{

;Store active window
        MouseGetPos, , , winID

;Left click near the song title in the "Now Playing" box.
        WinGetPos,  ,  ,  , spotifyHeight, %spotify%
        clickX := 578
        clickY := 577
        ControlClick, x%clickX% y%clickY% , %spotify%, , Left, , NA 


;Restore original window and mouse position.
        WinActivate ahk_id %winID%

        return
}

; Add track to Your Music
F9::
{

;Store active window
        MouseGetPos, , , winID

;Left click near the song title in the "Now Playing" box.
        WinGetPos,  ,  ,  , spotifyHeight, %spotify%
        clickX := 161
        clickY := 924
        ControlClick, x%clickX% y%clickY% , %spotify%, , Left, , NA 


;Restore original window and mouse position.
        WinActivate ahk_id %winID%

        return
}

;|-----------------|
;|--[ FUNCTIONS ]--|
;|-----------------|

;Context menu helper function.
GetContextMenuItemText(hMenu, nPos)
{
length := DllCall("GetMenuString"
, "UInt", hMenu
, "UInt", nPos
, "UInt", 0 ; NULL
, "Int", 0  ; Get length
, "UInt", 0x0400)   ; MF_BYPOSITION
VarSetCapacity(lpString, length + 1)
length := DllCall("GetMenuString"
, "UInt", hMenu
, "UInt", nPos
, "Str", lpString
, "Int", length + 1
, "UInt", 0x0400)
return lpString
}

Volume down/up now directly controls spotify.

I hope you can in corporate the f10 function in your app.

Dislike/like are f9 for songs and f7/f8 for radio both need adjusted to your position of spotify windows and mouse. But it works if set correctly, the user needs to be able to set those in your app tho.
If you do add those, make sure to add a note telling them that next track does not work in radio any more it is different now, you can but than you need to click it to make it work in your app it would be a pain and the script needs to be different. For me it is not needed in Radio.
I hope to see Like/dislike for songs to be supported otherwise I need to run a separate akh script.

2
I think I got the new Spotify partially working (play/pause/stop/next/prev).  Volume controls and like/dislike are not supported for the new Spotify.

Website | Download
v1.1.2 - 2015-05-16
    + Added partial support for the new Spotify client.  Tested against version
      1.0.4.90.  (Thanks, uniuse)


Will test it out, thanks for updating it for the new version.
Also as I will use it on Spotify too I will take up on me to keep you inform when Volume controls and like/dislike will work.

It works, volume down and up works partially because it lowers and increases the main volume instead of the application. For now it is great.

3
I think I got the new Spotify partially working (play/pause/stop/next/prev).  Volume controls and like/dislike are not supported for the new Spotify.

Website | Download
v1.1.2 - 2015-05-16
    + Added partial support for the new Spotify client.  Tested against version
      1.0.4.90.  (Thanks, uniuse)


Will test it out, thanks for updating it for the new version.
Also as I will use it on Spotify too I will take up on me to keep you inform when Volume controls and like/dislike will work.

4
Hi, uniuse, and welcome to the DonationCoder site.  Apologies for the delay in replying.

Can I ask if you can update Trout to not only remember when you close the app but across files so I can use it with MPH ?

I'm not sure what you're asking for here as MPH already supports Trout.  Regarding the new Spotify, I've tried to make it work but, due to how MPH is written, it's proving to be a right pain in the arse.

No need to add that functionality to Trout, I will use MPC instead.

No problem for the delay I am Happy that is updated.

5
N.A.N.Y. 2012 / Re: NANY 2012 Release: MPH (Media Player Hotkeys)
« on: April 27, 2015, 06:42 AM »
I use this one:
http://mplayer-ww.com/eng/

I did try to get that one to work in the past but was unable to.  This is a common problem with "front-end" type of players such as this one.  SMPlayer and MPUI are two other mplayer front-ends that I haven't been able to get to work.  The problem is exacerbated when those front-ends use custom skins instead of regular controls.

Now, that being said, if you have some AutoHotkey code that you happen to use that DOES control mplayer-WW, I'd be happy to test it out and add the support to MPH.

I also use SMPlayer because it has the option to remember track position for music files and across sessions. So it always starts where it left of.

I wanted to use MPH but I read SMPlayer is not supported.

Can I ask if you can update Trout to not only remember when you close the app but across files so I can use it with MPH ?

Thanks for your time.

EDIT: I found out that MPC does it as well, will test it.  
EDIT 2: It works on MPC not on Spotify. Will search for autohotkey and will inform you.
EDIT 3: There is a issue with the new spotify, it works if you are using multimedia keycodes. You can find more here: https://stackoverflo...ext-song-in-spotify#
Also I will test this script once it is fixed http://www.autohotke...out-opening-spotify/
Will keep you updated when it works. I would like to use Like en Dislike and for Mute you could use pause.
Edit 4: Downloaded the old version (Spotify 0.9.15.27) and got this and this script working.

Code: Autohotkey [Select]
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  3. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  4.  
  5. ;|---------------|
  6. ;|--[ SOURCES ]--|
  7. ;|---------------|
  8. ;Base Spotify Script from: http://www.autohotkey.com/board/topic/36239-spotify-global-hotkeys/
  9. ;Base Starring Script from: http://superuser.com/questions/324416/any-spotify-tweaks-with-keyboard-shortcut-to-star-tracks
  10.  
  11. ;|------------------|
  12. ;|--[ SETTING UP ]--|
  13. ;|------------------|
  14. DetectHiddenWindows, On ;Detect Spotify even if it's minimized
  15. #IfWinExist ahk_class SpotifyMainWindow ;Only do the following if Spotify is running
  16. spotify = ahk_class SpotifyMainWindow ;Set variable for Spotify Window Name
  17.  
  18. ;|---------------|
  19. ;|--[ HOTKEYS ]--|
  20. ;|---------------|
  21. ; "F5" for previous
  22. F5::
  23. {
  24.         ControlSend, ahk_parent, ^{Left}, %spotify%
  25.         return
  26. }
  27.  
  28. ; "F6" for next
  29. F6::
  30. {
  31.         ControlSend, ahk_parent, ^{Right}, %spotify%
  32.         return
  33. }
  34.  
  35. ; "F4" for pause
  36. F4::
  37. {
  38.         ControlSend, ahk_parent, {Space}, %spotify%
  39.         return
  40. }
  41.  
  42. ; "F10" for track-name
  43. F10::
  44. {
  45.         WinGetTitle, spotify_playing, %spotify% ;Get the title of Spotify which contains the track-name
  46.        
  47.         StringTrimLeft, trimmed_playing, spotify_playing, 10 ;Get rid of extra text and place into 'trimmed_playing'
  48.         StringReplace, replaced_playing, trimmed_playing,, -, All ;Replace en dash with normal dash and place into 'replaced_playing'
  49.        
  50.         clipboard = %replaced_playing% ;Copy the fixed text to clipboard
  51.         return
  52. }
  53.  
  54. ; "F3" for volume up
  55. F3::
  56. {
  57.         ControlSend, ahk_parent, ^{Up}, %spotify%
  58.         return
  59. }
  60.  
  61. ; "F2 for volume down
  62. F2::
  63. {
  64.         ControlSend, ahk_parent, ^{Down}, %spotify%
  65.         return
  66. }
  67.  
  68. ; "F8" for vote up
  69. F8::
  70. {
  71.  
  72. ;Store active window
  73.         MouseGetPos, , , winID
  74.  
  75. ;Left click near the song title in the "Now Playing" box.
  76.         WinGetPos,  ,  ,  , spotifyHeight, %spotify%
  77.         clickX := 639
  78.         clickY := 511
  79.         ControlClick, x%clickX% y%clickY% , %spotify%, , Left, , NA  
  80.  
  81.  
  82. ;Restore original window and mouse position.
  83.         WinActivate ahk_id %winID%
  84.  
  85.         return
  86. }
  87.  
  88. ; "F7" for vote down
  89. F7::
  90. {
  91.  
  92. ;Store active window
  93.         MouseGetPos, , , winID
  94.  
  95. ;Left click near the song title in the "Now Playing" box.
  96.         WinGetPos,  ,  ,  , spotifyHeight, %spotify%
  97.         clickX := 590
  98.         clickY := 510
  99.         ControlClick, x%clickX% y%clickY% , %spotify%, , Left, , NA  
  100.  
  101.  
  102. ;Restore original window and mouse position.
  103.         WinActivate ahk_id %winID%
  104.  
  105.         return
  106. }
  107.  
  108. ; "F9" for add to my songs
  109. F9::
  110. {
  111.  
  112. ;Store active window
  113.         MouseGetPos, , , winID
  114.  
  115. ;Left click near the song title in the "Now Playing" box.
  116.         WinGetPos,  ,  ,  , spotifyHeight, %spotify%
  117.         clickX := 178
  118.         clickY := 943
  119.         ControlClick, x%clickX% y%clickY% , %spotify%, , Left, , NA  
  120.  
  121.  
  122. ;Restore original window and mouse position.
  123.         WinActivate ahk_id %winID%
  124.  
  125.         return
  126. }
  127.  
  128. ;|-----------------|
  129. ;|--[ FUNCTIONS ]--|
  130. ;|-----------------|
  131.  
  132. ;Context menu helper function.
  133. GetContextMenuItemText(hMenu, nPos)
  134. {
  135.         length := DllCall("GetMenuString"
  136.                         , "UInt", hMenu
  137.                         , "UInt", nPos
  138.                         , "UInt", 0 ; NULL
  139.                         , "Int", 0  ; Get length
  140.                         , "UInt", 0x0400)   ; MF_BYPOSITION
  141.                 VarSetCapacity(lpString, length + 1)
  142.                 length := DllCall("GetMenuString"
  143.                         , "UInt", hMenu
  144.                         , "UInt", nPos
  145.                         , "Str", lpString
  146.                         , "Int", length + 1
  147.                         , "UInt", 0x0400)
  148.         return lpString
  149. }

Will tets with new version, will update again.
Also note to get the add to your music collection, thumbs up and down working you need to edit the script with you position. I would like to see a way that you can give that up in the application.  

Edit 5: With the new version this part only works.
Code: Autohotkey [Select]
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  3. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  4.  
  5. ;|---------------|
  6. ;|--[ SOURCES ]--|
  7. ;|---------------|
  8. ;Base Spotify Script from: http://www.autohotkey.com/board/topic/36239-spotify-global-hotkeys/
  9. ;Base Starring Script from: http://superuser.com/questions/324416/any-spotify-tweaks-with-keyboard-shortcut-to-star-tracks
  10.  
  11. ;|------------------|
  12. ;|--[ SETTING UP ]--|
  13. ;|------------------|
  14. DetectHiddenWindows, On ;Detect Spotify even if it's minimized
  15. #IfWinExist ahk_class SpotifyMainWindow ;Only do the following if Spotify is running
  16. spotify = ahk_class SpotifyMainWindow ;Set variable for Spotify Window Name
  17.  
  18. ;|---------------|
  19. ;|--[ HOTKEYS ]--|
  20. ;|---------------|
  21. ; "F5" for previous
  22. F5::Media_Prev
  23.  
  24. ; "F6" for next
  25. F6::Media_Next
  26.  
  27. ; "F4" for pause
  28. F4::Media_Play_Pause
  29.  
  30. ;|-----------------|
  31. ;|--[ FUNCTIONS ]--|
  32. ;|-----------------|
  33.  
  34. ;Context menu helper function.
  35. GetContextMenuItemText(hMenu, nPos)
  36. {
  37.         length := DllCall("GetMenuString"
  38.                         , "UInt", hMenu
  39.                         , "UInt", nPos
  40.                         , "UInt", 0 ; NULL
  41.                         , "Int", 0  ; Get length
  42.                         , "UInt", 0x0400)   ; MF_BYPOSITION
  43.                 VarSetCapacity(lpString, length + 1)
  44.                 length := DllCall("GetMenuString"
  45.                         , "UInt", hMenu
  46.                         , "UInt", nPos
  47.                         , "Str", lpString
  48.                         , "Int", length + 1
  49.                         , "UInt", 0x0400)
  50.         return lpString
  51. }

This works perfectly only in playlist or songs. Not on radio, there is no visible way to go back but if you use the hotkey it will force it and play random song.

Could you support the old version for me until the new one is fixed. I will of course help and test it.

Pages: [1]