Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: PLAY Next/previous playlist with keyboard only (Columns UI) (Read 1575 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

PLAY Next/previous playlist with keyboard only (Columns UI)

I've been setting up a nifty AutoHotKey script that will let me use my mouse as a remote control for foobar2000 and let me do rather a lot of things despite the fact that all I have is three buttons and a wheel. I might post the script here later when it's finished.

I'm using AHK to remap my mouse keys to global hotkeys already set up within foobar. I've set up shortcuts for next and previous playlist but they only work to a limited extent. The playlist view changes but foobar keeps playing the same playlist. It seems the only way to start playing is press up/down enter (see below) or double click, which is useless as this script takes complete control over all the mouse buttons. (this mouse remote control is designed to work even when you can't see the monitor)

Remember, I can use any keyboard shortcut solution but ideally it should work even when foobar is minimised. And it should play the first track in the playlist no matter which one is selected. (so mapping my mouse shortcut to the enter key is not a solution).

I suspect that what I ask for is impossible but I thought I'd ask anyway considering the number of tweak foobar tweak addicts out there who might've tried to do this already =]

Thanks.

 

PLAY Next/previous playlist with keyboard only (Columns UI)

Reply #1
If you can set your software to run a VBS script, you can install the COM Automation Server from my components page and use the following script with it. Save it to a file called switch-playlists.vbs. You might want to figure out how to parse command line arguments in VBS sou you can select whether to switch to the next or previous playlist. Alternatively, you can save two different versions of the script.

Code: [Select]
Option Explicit

dim ProgID, HelperProgID
ProgId = "Foobar2000.Application.0.7"
HelperProgID = "Foobar2000.ApplicationHelper.0.7"

dim bStartAlways, bSwitchToNext

'set to true to start foobar2000 if it is not running
bStartAlways = false

'set to false to switch to previous playlist
bSwitchToNext = true

dim oApp

if bStartAlways then
set oApp = WScript.CreateObject(ProgID)
if isnull(oApp) then
WScript.Quit
end if
else
dim oHelper
set oHelper = WScript.CreateObject(HelperProgID)
if isnull(oHelper) or not oHelper.Running then
WScript.Quit
end if
set oApp = oHelper.Server
end if

dim oPlaylists, oPlaylist
dim nIndex, nCount

set oPlaylists = oApp.Playlists
set oPlaylist = oPlaylists.ActivePlaylist

if isnull(oPlaylist) then
nIndex = 0
else
nIndex = oPlaylist.Index
nCount = oPlaylists.Count
if bSwitchToNext then
nIndex = nIndex + 1
if nIndex >= nCount then
nIndex = 0
end if
else
nIndex = nIndex - 1
if nIndex < 0 then
nIndex = nCount - 1
end if
end if
end if

set oPlaylist = oPlaylists(nIndex)
oPlaylists.ActivePlaylist = oPlaylist
oPlaylist.DoDefaultAction 0