msd1994 Posted September 3, 2015 Share Posted September 3, 2015 I made a general utility file for volume and playback control, using the _W7sound UDF for muting spotify and only spotify, but when trying to automate it, so whenever the title has or contains "Spotify" spotify should be muted. Otherwise, it should unmute spotify. If i initiate muting spotify with a hotkey, it works, and will unmute properly, but I want it to mute automatically as well. I've tried many different ways to do this, most recently this. expandcollapse popupwhile 1 Sleep(300) ; give time for title of window to change $title = WinGetTitle("[CLASS:SpotifyMainWindow]") ; check what title is If (StringInStr($title, "Spotify")) Then ; if not song title, mute. If Not $autoUnmute Then autoMute() EndIf EndIf If $autoUnmute Then ;var set by "autoMute", if true, check when to unmute. ToolTip("Muted", 0, 0) While (StringInStr($title, "Spotify")) Sleep(200) $title = WinGetTitle("[CLASS:SpotifyMainWindow]") WEnd ToolTip("") Sleep(300) If $autoUnmute Then _SetVolume("[CLASS:SpotifyMainWindow]", _GetVolume("[CLASS:SpotifyMainWindow]")) EndIf $autoUnmute = False EndIf Sleep(200) WEnd Func autoMute() $title = WinGetTitle("[CLASS:SpotifyMainWindow]") ; double check still muted If (StringInStr($title, "Spotify")) Then ; if it is, mute, set var to true so while loop checks when to unmute. _MuteVolume("[CLASS:SpotifyMainWindow]") $autoUnmute = True EndIf EndFuncif i remove the part above "If $autoUnmute Then" and just call autoMute myself with the hotkey I set, it works and properly mutes, then unmutes. Trying like this seems to have trouble though. Anyone have some idea why I would be having trouble? I did notice a slight delay in the time of me pausing Spotify and the actual title changing in "SndVol.exe" (volume mixer), but haven't been able to figure out how to fix this if that was the issue. Link to comment Share on other sites More sharing options...
computergroove Posted September 6, 2015 Share Posted September 6, 2015 This might help - https://code.google.com/p/spotifycmd/ Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now