AutoHotkey shortcut to like songs on Spotify

Post your working scripts, libraries and tools for AHK v1.1 and older
edu-hilario
Posts: 8
Joined: 30 Jul 2021, 15:12
Contact:

AutoHotkey shortcut to like songs on Spotify

Post by edu-hilario » 31 Mar 2022, 10:34

FINALLY! Months after I desisted of creating a shortcut to like the current song on Spotify Desktop I finally made it work. I detects if Spotify is in another desktop, jumps to the last page on the stack and tabs to the position of the like button. I'm so happy right now!!! :D

Code: Select all

!SC00D::
					DetectHiddenWindows, On	
					WinActivate, ahk_exe spotify.exe
					Loop, 10 {
						Send !{Right}
						Sleep 70
					}
					Send {Tab}
						Sleep 100
					Send {LAlt}
						Sleep 100
					Send {Esc}
						Sleep 100
					Loop, 15 {
						Send {Tab}
						Sleep 5
					}
					Send {Enter}
					Sleep 500
					Send {Alt Down}
					Send {Tab}
					Send {Alt Up}
					Return 		

edu-hilario
Posts: 8
Joined: 30 Jul 2021, 15:12
Contact:

Re: AutoHotkey shortcut to like songs on Spotify

Post by edu-hilario » 11 Apr 2022, 08:19

Update #1 — Code refactor

Using the search bar as a starting point is faster and more secure than using the Alt menu.

Code: Select all

DetectHiddenWindows, On
WinActivate, ahk_exe spotify.exe
WinWait, ahk_exe spotify.exe
Sleep 100
Send ^l
Sleep 100
Loop, 14 {
    Send {Tab}
}
Return

Descolada
Posts: 1127
Joined: 23 Dec 2021, 02:30

Re: AutoHotkey shortcut to like songs on Spotify

Post by Descolada » 12 Apr 2022, 10:14

Hello,
Try this script:

Code: Select all

^+l:: ; "Like" currently playing Spotify song by pressing Ctrl+Shift+L
^+r:: ; Remove "Like" from currently playing Spotify song by pressing Ctrl+Shift+R
	if !(spotifyId := WinExist("ahk_exe Spotify.exe")) {
		TrayTip, Error, Spotify was not found!
		return
	}
	try {
		if (oAcc := Acc_Get("Object", "4.1.1.1.1.1.1.2.1.1.3.1.1.4", 0, "ahk_id " spotifyId)) {
			hotkeyLike := InStr(A_ThisHotkey, "l")
			if (oAcc.accName(0) == (hotkeyLike ? "Save to Your Library" : "Remove from Your Library")) {
				oAcc.accDoDefaultAction(0)
				WinGetTitle, playingSong, ahk_id %spotifyId%
				TrayTip, Spotify, % (hotkeyLike ? "You liked " : "You removed a like from ") """" playingSong """!",,16
			} else if (oAcc.accName(0) == (hotkeyLike ? "Remove from Your Library" : "Save to Your Library")) {
				TrayTip, Spotify, % (hotkeyLike ? "You have already liked " : "You have not yet liked ") """" playingSong """!",,16
			}
		}
	}
	return
To use it, download Acc.ahk and put it in the Lib directory where you saved the script. Then Ctrl+Shift+L should like the currently playing song without activating Spotify.

Sourenics
Posts: 1
Joined: 28 Apr 2022, 03:48

Re: AutoHotkey shortcut to like songs on Spotify

Post by Sourenics » 28 Apr 2022, 03:50

Sorry, but for someone new on this, what are the steps I should follow for the script to work? I copied the code on my .ahk file but when I try to launch it, it shows an error and closes...

Edit.: Okay so I copied your code into the Acc.ahk script and now it opens, no errors. But when I click on ctrl + shift + L (or R) it does nothing on spotify desktop app.

Descolada
Posts: 1127
Joined: 23 Dec 2021, 02:30

Re: AutoHotkey shortcut to like songs on Spotify

Post by Descolada » 28 Apr 2022, 15:14

Sourenics wrote:
28 Apr 2022, 03:50
Sorry, but for someone new on this, what are the steps I should follow for the script to work? I copied the code on my .ahk file but when I try to launch it, it shows an error and closes...

Edit.: Okay so I copied your code into the Acc.ahk script and now it opens, no errors. But when I click on ctrl + shift + L (or R) it does nothing on spotify desktop app.
Sorry, it seems my original code broke with a Spotify update. I tried my hand at a second approach, perhaps this will work for a longer time...

Code: Select all

IUIAutomation := ComObjCreate(CLSID_CUIAutomation := "{ff48dba4-60ef-4201-aa87-54103eef594e}", IID_IUIAutomation := "{30cbe57d-d9d0-452a-ab13-7ac5ac4825ee}")

^+l:: ; "Like" currently playing Spotify song by pressing Ctrl+Shift+L
^+r:: ; Remove "Like" from currently playing Spotify song by pressing Ctrl+Shift+R
	if !(spotifyId := WinExist("ahk_exe Spotify.exe")) {
		TrayTip, Error, Spotify was not found!
		return
	}
	DllCall(NumGet(NumGet(IUIAutomation+0)+6*A_PtrSize), "ptr", IUIAutomation, "ptr", spotifyId, "ptr*", elementMain)   ; IUIAutomation::ElementFromHandle
	VarSetCapacity(likeVariant, 8 + (2 * A_PtrSize)), ComObject(0x400C, &likeVariant)[] := "Save to Your Library"
	VarSetCapacity(removeVariant, 8 + (2 * A_PtrSize)), ComObject(0x400C, &removeVariant)[] := "Remove from Your Library"
	if (A_PtrSize = 4) {
		DllCall(NumGet(NumGet(IUIAutomation+0)+23*A_PtrSize), "ptr", IUIAutomation, "int", 30005, "int64", NumGet(likeVariant, 0, "int64"), "int64", NumGet(likeVariant, 8, "int64"), "ptr*", likeCondition)   ; IUIAutomation::CreatePropertyCondition
		DllCall(NumGet(NumGet(IUIAutomation+0)+23*A_PtrSize), "ptr", IUIAutomation, "int", 30005, "int64", NumGet(removeVariant, 0, "int64"), "int64", NumGet(removeVariant, 8, "int64"), "ptr*", removeCondition)   ; IUIAutomation::CreatePropertyCondition
	} else {
		DllCall(NumGet(NumGet(IUIAutomation+0)+23*A_PtrSize), "ptr", IUIAutomation, "int", 30005, "ptr", &likeVariant, "ptr*", likeCondition)   ; IUIAutomation::CreatePropertyCondition
		DllCall(NumGet(NumGet(IUIAutomation+0)+23*A_PtrSize), "ptr", IUIAutomation, "int", 30005, "ptr", &removeVariant, "ptr*", removeCondition)   ; IUIAutomation::CreatePropertyCondition
	}
	DllCall(NumGet(NumGet(elementMain+0)+5*A_PtrSize), "ptr", elementMain, "int", TreeScope_Descendants := 0x4, "ptr", likeCondition, "ptr*", likeButtonElement) ; IUIAutomationElement::FindFirst
	DllCall(NumGet(NumGet(elementMain+0)+5*A_PtrSize), "ptr", elementMain, "int", TreeScope_Descendants := 0x4, "ptr", removeCondition, "ptr*", removeButtonElement) ; IUIAutomationElement::FindFirst
	DllCall(NumGet(NumGet(likeButtonElement+0)+23*A_PtrSize), "ptr",likeButtonElement, "ptr*", likeName) ; CurrentName
	DllCall(NumGet(NumGet(removeButtonElement+0)+23*A_PtrSize), "ptr",removeButtonElement, "ptr*", removeName) ; CurrentName
	if (likeName := StrGet(likeName)) {
		DllCall(NumGet(NumGet(likeButtonElement+0)+43*A_PtrSize), "ptr",likeButtonElement, "ptr", &(likeButtonRect,VarSetCapacity(likeButtonRect,16))) ; CurrentBoundingRectangle
		likeButtonBottomCoord := NumGet(likeButtonRect,12,"Int")
	}
	if (removeName := StrGet(removeName)) {
		DllCall(NumGet(NumGet(removeButtonElement+0)+43*A_PtrSize), "ptr",removeButtonElement, "ptr", &(removeButtonRect,VarSetCapacity(removeButtonRect,16))) ; CurrentBoundingRectangle
		removeButtonBottomCoord := NumGet(removeButtonRect,12,"Int")
	}
	
	if (likeName || removeName) {
		WinGetTitle, playingSong, ahk_id %spotifyId%
		if InStr(A_ThisHotkey, "l") {
			if (likeButtonBottomCoord > removeButtonBottomCoord) {
				DllCall(NumGet(NumGet(likeButtonElement+0)+16*A_PtrSize), "ptr", likeButtonElement, "int", UIA_InvokePatternId := 10018, "ptr*", doAction)   ; IUIAutomationElement::LegacyIAccessiblePattern
				DllCall(NumGet(NumGet(doAction+0)+4*A_PtrSize), "ptr", doAction)   ; DoDefaultAction
				ObjRelease(doAction)
				TrayTip, Spotify, % "You liked """ playingSong """!",,16
			} else
				TrayTip, Spotify, % "You have already liked """ playingSong """!",,16
		} else {
			if (likeButtonBottomCoord < removeButtonBottomCoord) {
				DllCall(NumGet(NumGet(removeButtonElement+0)+16*A_PtrSize), "ptr", removeButtonElement, "int", UIA_InvokePatternId := 10018, "ptr*", doAction)   ; IUIAutomationElement::LegacyIAccessiblePattern
				DllCall(NumGet(NumGet(doAction+0)+4*A_PtrSize), "ptr", doAction)   ; DoDefaultAction
				ObjRelease(doAction)
				TrayTip, Spotify, % "You removed a like from """ playingSong """!",,16
			} else
				TrayTip, Spotify, % "You haven't yet liked """ playingSong """!",,16
		}
	}
	ObjRelease(likeButtonElement)
	ObjRelease(removeButtonElement)
	ObjRelease(elementMain)
	elementMain := "", removeButtonBottomCoord := 0, likeButtonBottomCoord := 0, likeName := "", removeName := ""

	return
Note: this is my first time using the UIA classes and DllCalls, so I apologize in advance for any weird errors or behaviours...
Last edited by Descolada on 06 Jul 2022, 13:48, edited 1 time in total.

Anorak123
Posts: 1
Joined: 02 Jul 2022, 02:35

Re: AutoHotkey shortcut to like songs on Spotify

Post by Anorak123 » 02 Jul 2022, 02:42

I'm new to autohotkey and I was wondering how to fix it when I run your code and it says "you have already liked" and "you haven't yet liked" on songs regardless of if it is liked already.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: AutoHotkey shortcut to like songs on Spotify

Post by BoBo » 02 Jul 2022, 03:32

@to whom It may concern
using the ACC based script from above: viewtopic.php?p=456246#p456246
…is (AFAIK) "browser-release-dependent" bc the used acc-path might change with an update of Chrome/Edge, or is already different with your currently used one!

Maybe @Descolada is willing to embed a "release validation": checking if the browsers version is matching with the scripts currently used settings and, if possible, (semi-)auto-update its named/labeled element's ACC-path(s) accordingly? :think:

Well, having this as a standalone function would be heaven :)

Descolada
Posts: 1127
Joined: 23 Dec 2021, 02:30

Re: AutoHotkey shortcut to like songs on Spotify

Post by Descolada » 02 Jul 2022, 09:30

@BoBo, I'm not sure that I totally understand what you mean :) Using both an Acc path and UIA name in one script, and a function to convert between these two?
My UIA-based script still works (at least in my computer), even when Spotify isn't active.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: AutoHotkey shortcut to like songs on Spotify

Post by BoBo » 02 Jul 2022, 10:12

Descolada wrote:
02 Jul 2022, 09:30
@BoBo, I'm not sure that I totally understand what you mean :) Using both an Acc path and UIA name in one script, and a function to convert between these two?
My UIA-based script still works (at least in my computer), even when Spotify isn't active.
@Descolada - Sorry, I've confused the attempt using ACC with Spotify.exe :arrow: here (where the acc-path for elements won't change that often) instead of using a browser-based Spotify session where every browser change/update could mix up the order of the elements and therefore change its acc-paths. :shifty: (or if someone decides to use the script with Edge instead of Chrome that fixed acc-path won't work either).

Nevertheless, for the browser-based spotify session (or other webbrowser based "applications") it would be amazing to have an ACC-path(s) "updating"-module that checks out the current release number of the browser. If it didn't match with a "valid for"-setting within the script (ie after a browser update) the script will try to detect the actual/current/updated acc-path for that specific element and will provide that acc-path, or even better, update the script (if via an INI-Key setting or on-the-fly, or ... whatever fits best :shifty: ) Hope that makes sense. Thx 4 listening :)

Descolada
Posts: 1127
Joined: 23 Dec 2021, 02:30

Re: AutoHotkey shortcut to like songs on Spotify

Post by Descolada » 02 Jul 2022, 11:06

@BoBo, Spotify.exe is unfortunately kind of a browser-based solution: if you look at it with Window Spy, then it is of Chrome_WidgetWin_0 class. So every update might potentially mess up the Acc path, and that's why I prefer the second approach that I provided (using UIAutomation). :)

User avatar
MiM
Posts: 61
Joined: 20 Apr 2021, 04:31

Re: AutoHotkey shortcut to like songs on Spotify

Post by MiM » 20 Aug 2022, 18:11

Someone asked for this on the AHK Discord so i've made this while sleep deprived
(It's for the desktop application, not the browser)

Code: Select all

; Big thanks to Acc.ahk ~ "https://www.autohotkey.com/board/topic/77303-acc-library-ahk-l-updated-09272012/"
; And jeeswg ~ "https://www.autohotkey.com/boards/viewtopic.php?f=6&t=40615"
#SingleInstance, Force
SetBatchLines, -1
SetWinDelay, 0
;------------------------------------------------- Options --------------------------------------------------;
Hotkey, F1, Action ; For key names go to ~ "https://www.autohotkey.com/docs/KeyList.htm"
HideGuiTime := "3000" ; Amount of time the gui will be displayed in milliseconds
GuiAlpha := "200"
GuiColor := "ffffff"

TextColor := "000000"
TextMargin := "6" ; Padding above and below text

FontSize := "10"
FontFamily := "Verdana"
FontWeight := "" ; Bold, italic, underline etc or a number between 1 and 1000 (400 is normal and 700 is bold)
;------------------------------------------------------------------------------------------------------------;
Gui, +hwndGuiHwnd -Caption +AlwaysOnTop +E0x20 +ToolWindow
Gui, Color, %GuiColor%
Gui, Margin, 0, %TextMargin%
Gui, Font, S%FontSize% W%FontWeight%, %FontFamily%
Gui, Add, Text, +hwndTextHwnd w%A_ScreenWidth% c%TextColor% +Center, Added to playlist
Gui, Show, x0 y0 w%A_ScreenWidth% NA
WinSet, Transparent, 0, ahk_id %GuiHwnd%
Return

Action:
  Result := LikeCurrentSong()
  if (StrLen(Result.Song) > 50)
    Result.Song := SubStr(Result.Song, 1, 50) "..."
  if (Result = "Error")
      ShowGui("Error... is spotify running?", 4000)
  else {
    if (Result.Song = "") {
      ShowGui("An ad is playing!", HideGuiTime)
      Return
    }
    if (Result.State = True)
      ShowGui("Added """ Result.Song """ to liked songs.", HideGuiTime)
    else if (Result.State = False)
      ShowGui("Removed """ Result.Song """ from liked songs.", HideGuiTime)
    else
      ShowGui("Unknown error... contact MiM#9148 on discord!", HideGuiTime)
  }
Return

ShowGui(Text, Time) {
  Global
  WinSet, Transparent, %GuiAlpha%, ahk_id %GuiHwnd%
  GuiControl,, % TextHwnd, % Text
  SetTimer, HideGui, -%Time%
}

HideGui:
WinSet, Transparent, 0, ahk_id %GuiHwnd%
Return

LikeCurrentSong() {
  Critical
  DetectHiddenWindows, % (_:=A_DetectHiddenWindows)?"On":
  oMem := {}, oPos := {}
  oMem[1, 1] := Acc_ObjectFromWindow(WinExist("ahk_exe Spotify.exe"), 0x0)
  oPos[1] := 1, vLevel := 1
  Loop {
    if !vLevel
      Return "Error"
    if !oMem[vLevel].HasKey(oPos[vLevel]) {
      oMem.Delete(vLevel)
      oPos.Delete(vLevel)
      vLevelLast := vLevel, vLevel -= 1
      oPos[vLevel]++
      continue
    }
    oKey := oMem[vLevel, oPos[vLevel]]
    vName := "", vValue := ""
    if IsObject(oKey) {
      vRoleText := Acc_GetRoleText(oKey.accRole(0))
      vName := oKey.accName(0)
      vValue := oKey.accValue(0)
    }
    oChildren := Acc_Children(oKey)
    vLevelLast := vLevel, vLevel += 1
    oMem[vLevel] := oChildren
    oPos[vLevel] := 1
    if InStr(vName, "Now playing:") && !Song
      Song := RegExReplace(vName, "Now playing: ", "")
    if (vName = "Remove from Your Library") || (vName = "Save to Your Library") {
      if (Song != "")
        oKey.accDoDefaultAction(0)
      DetectHiddenWindows, % _
      Return {State:(vName="Save to Your Library"?True:False), Song:Song}
    }
  }
}
Acc_Init() {
  Static	h
  If Not	h
    h:=DllCall("LoadLibrary","Str","oleacc","Ptr")
}
Acc_Get(Cmd, ChildPath="", ChildID=0, WinTitle="", WinText="", ExcludeTitle="", ExcludeText="") {
  Static properties := {Action:"DefaultAction", DoAction:"DoDefaultAction", Keyboard:"KeyboardShortcut"}
  AccObj := IsObject(WinTitle)? WinTitle
  : Acc_ObjectFromWindow( WinExist(WinTitle, WinText, ExcludeTitle, ExcludeText), 0 )
  if ComObjType(AccObj, "Name") != "IAccessible"
    ErrorLevel := "Could not access an IAccessible Object"
  else {
    StringReplace, ChildPath, ChildPath, _, %A_Space%, All
  AccError:=Acc_Error(), Acc_Error(true)
  Loop Parse, ChildPath, ., %A_Space%
    try {
      if A_LoopField is digit
        Children:=Acc_Children(AccObj), m2:=A_LoopField ; mimic "m2" output in else-statement
      else
        RegExMatch(A_LoopField, "(\D*)(\d*)", m), Children:=Acc_ChildrenByRole(AccObj, m1), m2:=(m2?m2:1)
      if Not Children.HasKey(m2)
        throw
      AccObj := Children[m2]
    } catch {
      ErrorLevel:="Cannot access ChildPath Item #" A_Index " -> " A_LoopField, Acc_Error(AccError)
      if Acc_Error()
        throw Exception("Cannot access ChildPath Item", -1, "Item #" A_Index " -> " A_LoopField)
      return
    }
    Acc_Error(AccError)
    StringReplace, Cmd, Cmd, %A_Space%, , All
    properties.HasKey(Cmd)? Cmd:=properties[Cmd]:
    try {
      if (Cmd = "Location")
        AccObj.accLocation(ComObj(0x4003,&x:=0), ComObj(0x4003,&y:=0), ComObj(0x4003,&w:=0), ComObj(0x4003,&h:=0), ChildId)
        , ret_val := "x" NumGet(x,0,"int") " y" NumGet(y,0,"int") " w" NumGet(w,0,"int") " h" NumGet(h,0,"int")
      else if (Cmd = "Object")
        ret_val := AccObj
      else if Cmd in Role,State
        ret_val := Acc_%Cmd%(AccObj, ChildID+0)
      else if Cmd in ChildCount,Selection,Focus
        ret_val := AccObj["acc" Cmd]
      else
        ret_val := AccObj["acc" Cmd](ChildID+0)
    } catch {
      ErrorLevel := """" Cmd """ Cmd Not Implemented"
      if Acc_Error()
        throw Exception("Cmd Not Implemented", -1, Cmd)
      return
    }
    return ret_val, ErrorLevel:=0
  }
  if Acc_Error()
    throw Exception(ErrorLevel,-1)
}
Acc_ObjectFromWindow(hWnd, idObject = -4) {
  Acc_Init()
  if	DllCall("oleacc\AccessibleObjectFromWindow", "Ptr", hWnd, "UInt", idObject&=0xFFFFFFFF, "Ptr", -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,"Int64"),"Int64"), "Ptr*", pacc)=0
    Return	ComObjEnwrap(9,pacc,1)
}
Acc_GetRoleText(nRole) {
  nSize := DllCall("oleacc\GetRoleText", "Uint", nRole, "Ptr", 0, "Uint", 0)
  VarSetCapacity(sRole, (A_IsUnicode?2:1)*nSize)
  DllCall("oleacc\GetRoleText", "Uint", nRole, "str", sRole, "Uint", nSize+1)
  Return	sRole
}
Acc_Children(Acc) {
  if ComObjType(Acc,"Name") != "IAccessible"
    ErrorLevel := "Invalid IAccessible Object"
  else {
    Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]
    if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 {
      Loop %cChildren%
        i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child):
      return Children.MaxIndex()?Children:
    }
    else
      ErrorLevel := "AccessibleChildren DllCall Failed"
	}
  if Acc_Error()
    throw Exception(ErrorLevel,-1)
}
Acc_Error(p="") {
  Static setting:=0
  return p=""?setting:setting:=p
}
Acc_ChildrenByRole(Acc, Role) {
  if ComObjType(Acc,"Name")!="IAccessible"
    ErrorLevel := "Invalid IAccessible Object"
  else {
    Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]
    if DllCall("oleacc\AccessibleChildren", "Ptr",ComObjValue(Acc), "Int",0, "Int",cChildren, "Ptr",VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&varChildren, "Int*",cChildren)=0 {
      Loop %cChildren% {
        i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i)
        if NumGet(varChildren,i-8)=9
          AccChild:=Acc_Query(child), ObjRelease(child), Acc_Role(AccChild)=Role?Children.Insert(AccChild):
        else
          Acc_Role(Acc, child)=Role?Children.Insert(child):
      }
      return Children.MaxIndex()?Children:, ErrorLevel:=0
    }
    else
      ErrorLevel := "AccessibleChildren DllCall Failed"
  }
  if Acc_Error()
    throw Exception(ErrorLevel,-1)
}
Acc_Query(Acc) { ; thanks Lexikos - www.autohotkey.com/forum/viewtopic.php?t=81731&p=509530#509530
  try return ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1)
}
Acc_Role(Acc, ChildId=0) {
  try return ComObjType(Acc,"Name")="IAccessible"?Acc_GetRoleText(Acc.accRole(ChildId)):"invalid object"
}
Acc_State(Acc, ChildId=0) {
  try return ComObjType(Acc,"Name")="IAccessible"?Acc_GetStateText(Acc.accState(ChildId)):"invalid object"
}
Acc_GetStateText(nState) {
  nSize := DllCall("oleacc\GetStateText", "Uint", nState, "Ptr", 0, "Uint", 0)
  VarSetCapacity(sState, (A_IsUnicode?2:1)*nSize)
  DllCall("oleacc\GetStateText", "Uint", nState, "str", sState, "Uint", nSize+1)
  Return	sState
}
Ugly gui, ugly syntax, ugly logic, a lot of things can be cleaned up but i don't care enough, just posting this in case someone finds it useful.

snwflake
Posts: 3
Joined: 15 Dec 2021, 18:16

Re: AutoHotkey shortcut to like songs on Spotify

Post by snwflake » 26 Oct 2022, 17:23

@MiM, I'm trying to understand your `LikeCurrentSong` Method, but failing miserably...can you point me towards any resource that would make sense of how you got it to that point?
I'm currently trying to add similar hotkeys for "I don't like this song"/"I don't like ${artist}" in the discover weekly/release radar playlists.

User avatar
MiM
Posts: 61
Joined: 20 Apr 2021, 04:31

Re: AutoHotkey shortcut to like songs on Spotify

Post by MiM » 27 Oct 2022, 22:32

snwflake wrote:
26 Oct 2022, 17:23
@MiM, I'm trying to understand your `LikeCurrentSong` Method, but failing miserably...can you point me towards any resource that would make sense of how you got it to that point?
I'm currently trying to add similar hotkeys for "I don't like this song"/"I don't like ${artist}" in the discover weekly/release radar playlists.
What i posted is badly written, i just mashed stuff from acc.ahk.
Basically just getting the relevant elements and simulating a click on them. (it's a pain to pin point elements btw)
I've linked acc.ahk in the snippet, i could make a whole library about interacting with spotify but i don't care enough since i don't even use spotify..

If you need further help i'd rather chat on discord ~ MiM#9148 (or join the ahk discord server!)

Post Reply

Return to “Scripts and Functions (v1)”