Sub PlayNext
on error resume next
If (SDB.Player.isPlaying) And (Not SDB.Player.isStartingPlayback) Then
SDB.Player.Next
'The following song is played and should be marked at the same time.
SendKeys {F8} ' ?????????????????????
End if
End Sub
I have a playlist of songs that have never been played.
1. I double-click the first song and listen to it.
2. If I like the song, I trigger this script and the next song plays - but it has no focus.
3. Now I decide: delete the current song? YES
Not possible because the current song has no focus yet.
I have the HOTKEY for the F8 key:
"General: Focus tracklist on currently playing item" assigned.
Last edited by Erwin Hanzl on Mon Jan 18, 2021 2:48 am, edited 1 time in total.
Hi,
I guess it would be the best to have two scripts eg. one for like and one for dislike/delete. As soon as you hear tracks is to assigned global variable and you can control it with script no focus needed.
You can use that info to show on screen if you also want to check before you decide and switch to next track.
Sub PlayNext
'on error resume next
If (SDB.Player.isPlaying) And (Not SDB.Player.isStartingPlayback) Then
SDB.Player.Next
Dim a
Set a = CreateObject("WScript.Shell")
a.SendKeys "{F8}"
End if
End Sub
And finally, I assign a hot key to this script.
Tools> Options> General ... HOTKEYS
"General: Execut script: PlayNext"
Hi,
Hmmm, that still do not explain why you need focus on Current track when you can just ignore it and use additional script with command to delete track if you do not like it and select next track or use your existing Script to Like track and go to next.
Other approach would be to register On play Event and focus on current playing track. eg. something like this.
Script.RegisterEvent SDB, "OnPlay", "SDB_OnTrackPlay"
Dim InEventHandler : InEventHandler = False ' Control variable (shows if event handler is executing)
Sub SDB_OnTrackPlay(TrackList)
If InEventHandler Then Exit Sub ' Prevent executing event handler from within itself
InEventHandler = True ' Event starts --> set control variable
Dim a
Set a = CreateObject("WScript.Shell")
a.SendKeys "{F8}"
End Sub