DonationCoder.com Forum

DonationCoder.com Software => Older DC Contests and Challenges => N.A.N.Y. 2012 => Topic started by: skwire on October 17, 2011, 01:35 AM

Title: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on October 17, 2011, 01:35 AM
NANY 2012 Entry Information

Application Name MPH (Media Player Hotkeys)
Supported OSes Windows 7.  Probably works, but not tested on, Windows XP/Vista/8/10
Web Page Website (http://skwire.dcmembers.com/wb/pages/software/mph.php)
Download Link Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
Author Jody Holmes (Skwire Empire) (http://skwire.dcmembers.com)

Description
MPH (Media Player Hotkeys) is a hotkey application designed to allow you to control various audio, video and media players from one set of global hotkeys.

Features

Screenshots
[ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]

[ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]

[ You are not allowed to view attachments ]

Usage
Installation
Download the zip file and extract its contents into a new folder.  Run MPH.exe to start the application.

Using the Application
Set some hotkeys and try it.

Uninstallation
Delete the folder you unzipped it to.  The application doesn't write to the registry.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 16, 2011, 07:53 PM
[reserved]
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: zircle on December 16, 2011, 08:26 PM
This looks pretty neat. Does this give priority for a certain media player over another? I notice when say i have ITunes and Foobar open, the pause/play button either doesn't work or gives ITunes priority even though neither are focused.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 16, 2011, 08:38 PM
Hmmm...iTunes isn't supported directly so I'm surprised it works but, yes, you can reorder the supported applications in the Players tab.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: kyrathaba on December 17, 2011, 07:01 AM
Very nice looking app, skwire!
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: mouser on December 22, 2011, 09:14 AM
Written up at ghacks today:
http://www.ghacks.net/2011/12/22/configure-your-own-media-player-hotkeys/
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 22, 2011, 09:25 AM
Cool, thanks for the heads up.   :)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 22, 2011, 11:53 AM
Website (http://skwire.dcmembers.com/wb/pages/software/mph.php) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.0.2 - 2011-12-22
    + Added support for AIMP3 (http://www.aimp.ru).  (Thanks, qw)
Title: Support for Microsoft Natural Ergonomic Keyboard 4000?
Post by: Martin0815 on May 10, 2012, 09:04 AM
Hi,

tried MPH together with my MS Natural Ergonomic Keyboard 4000 and ... it does not seem to work.
Using the tray context menu 1by1 reacts as expected, but using the multimedia keys does not cause a reaction.

Any hints how to make it work?

Best regards,

Martin
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on May 10, 2012, 10:03 AM
tried MPH together with my MS Natural Ergonomic Keyboard 4000 and ... it does not seem to work.
Using the tray context menu 1by1 reacts as expected, but using the multimedia keys does not cause a reaction.

Hi, Martin, and welcome to the DonationCoder site.  May I assume you have set up individual hotkeys for each action that correspond to your multimedia keys?
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: Martin0815 on May 10, 2012, 10:48 AM
tried MPH together with my MS Natural Ergonomic Keyboard 4000 and ... it does not seem to work.
Using the tray context menu 1by1 reacts as expected, but using the multimedia keys does not cause a reaction.

Hi, Martin, and welcome to the DonationCoder site.  May I assume you have set up individual hotkeys for each action that correspond to your multimedia keys?

Sorry, I didn't get the point.

I set up single hotkeys, e.g. PlayPause, VolumeUp, VolumeDown, ShowHidePlayer.

But e.g. Volume(Up|Down) still uses the system volume up or down.

So I changed all configure hotkeys to use the modifier Ctrl and even now e.g. VolumeDown controlled the system volume by decreasing it, not the players (1by1) volume.

I thought the concept of MPH is to define/setup individual hotkeys.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on May 10, 2012, 11:57 AM
Would you mind emailing me your config.ini and hotkeys.lst file to: skwire [at] dcmembers [dot] com?

Also, which operating system are you using?
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: Martin0815 on May 10, 2012, 12:50 PM
Would you mind emailing me your config.ini and hotkeys.lst file to: skwire [at] dcmembers [dot] com?

Also, which operating system are you using?

Files and information sent to you via email!

Greets,

Martin
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on May 10, 2012, 01:16 PM
Thank you for the files.  The fact that you previously mentioned that the tray/popup menu works as expected tells me that MPH is sending the correct commands to control 1x1.  I tested your files here and all four hotkeys work fine with the latest 1x1 player (v1.76).

This leads me to believe that there is a conflict going on with your multimedia keys.  It's possible that the IntelliType Pro software you're using is causing this conflict.  Can you verify within IntelliType Pro that your media keys haven't been assigned to other functions or something similar?  I use an older MS Natural keyboard like the one shown here: http://en.wikipedia.org/wiki/Microsoft_Natural_keyboard (http://en.wikipedia.org/wiki/Microsoft_Natural_keyboard).  However, I do not use the IntelliType Pro software; I just use the basic driver that Windows installs for it.  If it's possible, maybe try disabling the IntelliType Pro software and see if that gets things working.  Please let me know.  Thanks.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on July 13, 2012, 05:46 PM
Website (http://skwire.dcmembers.com/wb/pages/software/mph.php) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.0.3 - 2012-07-12
    + Added support for Spotify (http://www.spotify.com).
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: Rockets on October 28, 2012, 08:42 PM
Could you add mplayer too, please?
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on October 28, 2012, 11:16 PM
Hello, Rockets, and welcome to the DonationCoder site.  AFAIK, mplayer, by itself, doesn't include a GUI.  Did you have in mind a particular GUI for mplayer?
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: Rockets on October 29, 2012, 07:52 AM
I use this one:
http://mplayer-ww.com/eng/
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on October 29, 2012, 01:17 PM
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.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: ewemoa on December 15, 2012, 10:58 PM
Written up at ghacks today:
http://www.ghacks.net/2011/12/22/configure-your-own-media-player-hotkeys/

Media player hotkeys allow you to control the media player with the keyboard and even if the program window is not the active window on the system. That’s handy if you are working in fullscreen applications or do not want to switch regularly between the window you are working in and the media player window.
-ghack article

With multiple displays, it seems a matter of time before one wants to have a video playing on one display while working on another display -- e.g. watching a development-oriented video tutorial on one display while following tutorial steps on another.

In my environment, it turns out that the media keys are not very convenient to use so I chose to use the fourth mouse button for play / pause using VLC.  This seems to be working well so far with MPH  :up:

Thanks skwire for MPH (and mouser for the article link) :)


P.S. I appreciate the "Start minimized", "Minimize to tray", and "Close to tray" options!
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 15, 2012, 11:05 PM
@ewemoa: Thanks for the report and kind words.  Much appreciated.   :)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: ewemoa on December 16, 2012, 01:32 AM
I'd like to be able to jump back a bit in the currently playing video but I have not succeeded in figuring out how to do this with MPH.

Is this currently possible?

I think in VLC there are a variety of actions:

  Shift+Left -> very short backwards jump
  Alt+Left -> short backwards jump
  Ctrl+Left -> medium backwards jump
  Ctrl+Alt+Left -> long backwards jump
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 16, 2012, 08:42 AM
Is this currently possible?

No, it's not.  I designed MPH with the intention that only the main or basic actions of players would be supported.  You could set up global hotkeys for these actions directly within VLC, no?
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: ewemoa on December 16, 2012, 04:59 PM
Thanks for the response.

No, it's not.  I designed MPH with the intention that only the main or basic actions of players would be supported.  You could set up global hotkeys for these actions directly within VLC, no?

Aha.  I didn't remember the global hotkeys angle earlier.  I will give this a try.  Thanks for the idea  :up:
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: ewemoa on December 19, 2012, 10:41 PM
Sometimes I have MPH running while no media players are running -- I got to thinking it might be convenient in such a situation for an appropriate player to get started up if one of the configured MPH hotkeys was entered.  In my brief testing and scanning of the documentation, I got the impression that this is not how things work currently.  Assuming that's correct, how does this idea sound?

Random implementation-related thoughts...
I guess that somehow MPH would need to know or become aware of paths of appropriate starting programs (e.g. if a player is launched via a batch file, the path of that batch file).  FWIW, I wouldn't mind specifying such information in an ini file :)

If MPH did have that info, may be upon receiving a hotkey, if it found no players running corresponding to the hotkey, it could start the top-most matching player.




P.S. The suggested global hotkey idea for rewinding has been working ok.  Thanks again for the pointer  :up:
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 21, 2012, 02:28 AM
Website (http://skwire.dcmembers.com/wb/pages/software/mph.php) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.0.4 - 2012-12-21
    + Added option allowing you to specify a file to launch if a hotkey is
      triggered and no players are running.  For example, you could specify
      a player to launch or even a custom script of your own.  (Thanks, ewemoa)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: ewemoa on December 21, 2012, 02:35 AM
Thanks!  Working well here under Windows 7 Pro 64-Bit.

Appreciate the relative path support too  :up:
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on June 01, 2013, 01:40 PM
Website (http://skwire.dcmembers.com/wb/pages/software/mph.php) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.0.5 - 2013-06-01
    + Added support for Media Player Classic 64-bit. (Thanks, Zac C.)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 01, 2013, 07:48 PM
Website (http://skwire.dcmembers.com/wb/pages/software/mph.php) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.0.7 - 2013-12-01
    + Added support for the Pandora Desktop app.  (Thanks, David S.)
    * Made main form resizable.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on June 30, 2014, 02:44 PM
Website (http://skwire.dcmembers.com/fp/?page=mph) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.0.9 - 2014-06-30
    ! Media Player Classic "previous track" function didn't work properly
      (Thanks, Mike H.)

v1.0.8 - 2014-03-26
    + Added ability to reload the application from the tray menu.  Sometimes,
      after playing a game or other full-screen app, the hotkeys fail to work.
      Instead of shutting down and restarting MPH manually, you can simply use
      the "Reload" option from the tray menu.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on January 02, 2015, 03:36 PM
Website (http://skwire.dcmembers.com/fp/?page=mph) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.1.1 - 2015-01-02
    + Added 'Reload' command to the popup menu.

v1.1.0 - 2014-06-30
    ! Media Player Classic (32-bit) "previous track" function didn't work
      properly.  (Thanks, Mike H.)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: captain1701 on February 25, 2015, 05:58 AM
Hi,

thanks for this great software.

I have just a small problem with the usage under Windows 7 x64. I setup four actions (play/pause, show/hide, previous and next) but only the first two are working with Windows Media Player.
Previous and next don't jump to another song, they just jump inside the current song.

Do I miss a setting to get this work correct?

Thanks,
Martin
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on February 25, 2015, 10:32 AM
Hi, captain1701, and welcome to the DonationCoder site.   :D

I have just a small problem with the usage under Windows 7 x64. I setup four actions (play/pause, show/hide, previous and next) but only the first two are working with Windows Media Player.
Previous and next don't jump to another song, they just jump inside the current song.

I just tested it with Windows Media Player v12.0.7601.18150 under W7/64 Ultimate and it seems to work okay.  Which version of Windows Media Player are you using?
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: captain1701 on February 27, 2015, 02:49 AM
Hi,

thanks for the fast response.

It's really strange, at Home W7/64 Pro and WMP v12.0.7601.18150 it works but at work, same OS and WMP version it doesn't. :(

I already thought of some program maybe interfering with the combo Win+Ctrl+F3 and Win+Ctrl+F4 but I don't know one using this.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on February 27, 2015, 03:08 AM
It's really strange, at Home W7/64 Pro and WMP v12.0.7601.18150 it works but at work, same OS and WMP version it doesn't. :(
I already thought of some program maybe interfering with the combo Win+Ctrl+F3 and Win+Ctrl+F4 but I don't know one using this.

Some things to try at work:

Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: captain1701 on February 27, 2015, 05:39 AM
Okay, I found the cause but no idea why.

If I change Win+Ctrl+... to Win+Shift+... it works. Looks like at work there is a program using Win+Ctrl combos installed. But only some because Win+Ctrl+F1 for play/pause is working.  ;)

Thanks for the help.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on February 27, 2015, 09:28 AM
Okay, I found the cause but no idea why.

If I change Win+Ctrl+... to Win+Shift+... it works. Looks like at work there is a program using Win+Ctrl combos installed. But only some because Win+Ctrl+F1 for play/pause is working.  ;)

Thanks for the help.

You're welcome.  Good luck!   :)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: uniuse 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://stackoverflow.com/questions/28957636/hotkey-for-next-song-in-spotify#
Also I will test this script once it is fixed http://www.autohotkey.com/board/topic/94218-spotify-global-hotkeys-volume-control-skip-songs-current-song-to-clipboard-star-songs-without-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 (http://www.autohotkey.com/board/topic/94218-spotify-global-hotkeys-volume-control-skip-songs-current-song-to-clipboard-star-songs-without-opening-spotify/) and this (http://www.autohotkey.com/board/topic/112934-add-song-to-your-music-in-spotify/) 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.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on May 16, 2015, 06:31 PM
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.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on May 16, 2015, 07:55 PM
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 (http://skwire.dcmembers.com/fp/?page=mph) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.1.2 - 2015-05-16
    + Added partial support for the new Spotify client.  Tested against version
      1.0.4.90.  (Thanks, uniuse)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: uniuse on May 17, 2015, 07:23 AM
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.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: uniuse on May 17, 2015, 07:31 AM
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 (http://skwire.dcmembers.com/fp/?page=mph) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
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.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: uniuse on May 26, 2015, 10:41 AM
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 (http://skwire.dcmembers.com/fp/?page=mph) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
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.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on May 26, 2015, 11:05 AM
Right on.  Thanks for the report.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: uniuse on June 14, 2015, 03:17 PM
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.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: david842 on February 06, 2016, 11:30 AM
I would definitely use this product if it covered all the video players that I use regularly. It would have to address the really difficult programming challenges of YouTube, UStream, and similar browser-based players, which all have buggy and incomplete user controls. I would definitely donate for that.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on February 06, 2016, 11:37 AM
Hi, david842, and welcome to the DonationCoder site.   :D

I would definitely use this product if it covered all the video players that I use regularly. It would have to address the really difficult programming challenges of YouTube, UStream, and similar browser-based players, which all have buggy and incomplete user controls. I would definitely donate for that.

Unfortunately, I've no desire to even try and support browser-based players.  As King Lear said, "That way madness lies."
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: david842 on February 06, 2016, 12:45 PM
Your reply shows great intelligence. BTW, is 2012 the last NANY programming competition, or did they continue to 2015?
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: tomos on February 06, 2016, 01:00 PM
^  hi david842,
NANY is still going strong. Here's the 2016 one:
https://www.donationcoder.com/forum/index.php?board=323.0

Earlier ones you can find here (scroll down for more recent):
https://www.donationcoder.com/forum/index.php?board=210.0
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: daniloco on February 25, 2016, 08:32 AM
In the last days a new version of AIMP (version 4) has been released.
As you might guess, MPH does'nt work with it  :(
This time the process name is simply AIMP.exe, no version number added to the name.
Could you please add it to the list of supported players?
Thanks in advance.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on February 29, 2016, 12:15 AM
Hi, daniloco, and welcome to the DonationCoder site.   :)

In the last days a new version of AIMP (version 4) has been released.
As you might guess, MPH does'nt work with it  :(
This time the process name is simply AIMP.exe, no version number added to the name.
Could you please add it to the list of supported players?

Ask, and ye shall receive.   ;)   Cheers.

Website (http://skwire.dcmembers.com/fp/?page=mph) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.1.3 - 2016-02-29
    + Added support for AIMP4 (http://www.aimp.ru).  (Thanks, daniloco)


Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: rehuh on December 17, 2016, 08:13 AM
Hello,
Is it possible to add MPC-BE to the list of supported players ?
If you can do that it will be very cool  :)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 18, 2016, 11:43 AM
Hi, rehuh, and welcome to the DonationCoder forums.   :)

Is it possible to add MPC-BE to the list of supported players ?

Sure.  I only seem to be able to find the 64-bit version (which I have working in MPH).  Is there a 32-bit version?
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: rehuh on December 18, 2016, 02:30 PM
Yes, i've actually a 32-bit version because the video renderer im using is only available for MPC-BE in 32bit.

You can find the last 32-bit version here : https://sourceforge.net/projects/mpcbe/files/MPC-BE/Release%20builds/1.5.0/

Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 20, 2016, 12:12 PM
Please give this a try:

Website (http://skwire.dcmembers.com/fp/?page=mph) | Download (http://skwire.dcmembers.com/apps/mph/MPH.zip)
v1.1.4 - 2016-12-20
    + Added support for Media Player Classic BE. (Thanks, rehuh)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: rehuh on December 22, 2016, 06:38 AM
Everything seems to be working good.

Thanks for adding it !  :)
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on December 24, 2016, 06:15 PM
Everything seems to be working good.
Thanks for adding it !  :)

Good to hear and you're quite welcome.  I'm glad you find the program useful.
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: bkvamme on March 02, 2017, 04:16 AM
Cheerio!

Stumbled across this program in search for my hotkey troubles.

Any chance of adding support for Plex Media Player? It has support for Media Keys, but needs the program to be in focus when pressing the buttons.

Download link: https://www.plex.tv/downloads/

Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: skwire on March 05, 2017, 10:33 PM
Hi, bkvamme, and welcome to the DonationCoder site.

Any chance of adding support for Plex Media Player? It has support for Media Keys, but needs the program to be in focus when pressing the buttons.

I'm pretty sure you're referring to the browser-based Plex Media Player, right?  If so, and in my experience, there really isn't a reliable way to control these types of players remotely the way that MPH works.  As an aside, I run a Plex server and love it's functionality.   :Thmbsup:
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: bkvamme on March 06, 2017, 04:08 AM
Hi,

Many thanks!

Haha, brilliant that you're using this aswell.

I'm actually referring to the Plex Media Player Windows App. It appears that this has the same "struggles" as other softwares here (media buttons work when the program is in focus, but not in the background). I prefer using the app to avoid transcoding as much as possible :)

https://www.plex.tv/downloads/#plex-app

[ You are not allowed to view attachments ]
Title: Re: NANY 2012 Release: MPH (Media Player Hotkeys)
Post by: wokawoka on May 17, 2017, 12:15 PM
Hello,
thank you very much for this project, it's just great!

Would it be possible to add the pandora open source client Elpis ( https://github.com/adammhaile/Elpis ) to the list of the supported programs?
At the moment I'm somewhat able to control it trough MPH when spotify is opened paused in the backgroung but being able to control it in a proper way would be awesome.

Thank you very much and keep up the great work!