4
votes

I want to pull out the current track information from Spotify windows client using autohotkey.

Although this question Hotkey for next song in Spotify solved some of the problems (the media playback issues) in the commonly used ahk script (can be found in this question: Newest Spotify update: Autohotkeys script broke and below), the track info shortcut still does not work.

^Down:: 
{ 
DetectHiddenWindows, On 
SetTitleMatchMode 2 
WinGetTitle, now_playing, ahk_class SpotifyMainWindow 
;StringTrimLeft, playing, now_playing, 10 
DetectHiddenWindows, Off 
clipboard = %playing%`r`n
return 
}

This will give me "Spotify free" no matter what song I am playing.

The main problem is that the tray icon and the task bar icon stopped showing the currently played song information after this update. Only text Windows spy can find from the task bar icon is now "Spotify Free".

So, I tried to get all controllist and extract texts in each of them by following the example in this question: How to obtain textual contents from a window

But, I could only find two controls ("Chrome_WidgetWin_01" and "Chrome_RenderWidgetHostHWND1") and Window spy can find text "Chrome Legacy Window" and this is all it finds.

Is there a way to dig into this further? I noticed in the Windows Task Manager there are 3 spotify.exe instances. Would looking into other processes help?

PS AHK Window Info 1.7 (http://www.autohotkey.com/board/topic/8204-ahk-window-info-17/) is not available for download at moment. so i could only use Ahk Window Spy 1.3.3 by Decarlo.

Oh, I found the code for AHK Window Info pasted as spoiler at http://www.autohotkey.com/board/topic/8204-ahk-window-info-17/page-6 But it did not help. information found was not more than Ahk Window Spy.

(edit) UISpy from microsoft gives me a bit more info but it's not possible to get texts in Spotify client. And, I realized that it's a good thing in terms of security (otherwise malware can read my email password etc). So, unless Spotify client wants to expose this information, it would be hard or not possible to do this by ahk. Is this correct or any cleaver way around in this particular case?

1
I did a little hack to make it so my Spotify client won't upgrade to the latest. That way I'm still able to pull the info by the old method.Elliot DeNolf
That's nice. Then you can just wait until the spotify dev fix the issue (hopefully). Unfortunately it's too late for me...otterb
I got the old version on FileHorse after doing some googling a while back. If interested, I can write up the steps I did to roll back and prevent updates.Elliot DeNolf
That would be very nice. Now that I realized how difficult this would be, I am actually interested in rolling back.otterb

1 Answers

2
votes

EDIT: This solution is no longer needed. The song artist and title have been added back to the Window Title.

The best solution is to downgrade Spotify to a 0.9 version from FileHorse. Then do the following:

  1. Go to C:\Users\YOURUSERNAME\Appdata\Roaming\Spotify
  2. Make a new empy text file
  3. Name it Spotify_new.exe
  4. Right click the file and make the file read-only
  5. Copy this file and name the new one Spotify_new.exe.sig
  6. Spotify needs to delete these files to do an automatic upgrade. The read-only flag on both of these files will prevent upgrading from happening.

I haven't had any issues running an old version at this point in time.