I am working on a module for FOOBAR2K, a music player.
So that it can be controlled and used from the terminal, For example Get-FooBar -status
:
Name Value
---- -----
Artist Antonio Carlos Jobim
Song Amparo
Album Stone Flower
Current Time 0:09
Total Time 3:42
Path C:\Music Library\Antonio Carlos Jobim - Stone Flower\Amparo.flac
I have covered quite a bit of ground. One functionality I need is to add\append to the currently playing playing files.
I can take some songs and create a new "currently playing" list just fine:
Get-ChildItem -path ".\Antonio Carlos Jobim - Stone Flower" -Exclude *sabia*,*amp* | Set-FooBar
But I sometimes need a way to append to the "Currently Playing List". I did some investigation, in File Explorer, If I right click a file that Foobar is set to handle, there are two entries from Foobar:
- "Play in Foobar"
- "Enqueue in Foobar"
Using Enqueue in Foobar
on a selection of audio file in Explorer will add those files to FOOBAR's "Currently Playing" list.
I am interested in invoking this verb from PowerShell. I did some searching and experimenting:
This article Use PowerShell to Work with Windows Explorer - Scripting Blog I was able to find verbs for folders but passing Files in the same way, returns errors:
$Shell = New-Object -ComObject 'Shell.Application'
$Shell.NameSpace('C:\Music Library\Antonio Carlos Jobim - Stone Flower\Amparo.flac').Self.Verbs()
Error:
OperationStopped:
Line |
2 | $Shell.NameSpace('C:\Music Library\Antonio Carlos Jobim - Stone...
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Error HRESULT E_FAIL has been returned from a call to a COM component.
I ran into similar issues with answers I found on StackOverflow as well.
Thanks for any help.