PowerShell Hotkey to Pause Pandora
Fri, Feb 26, 2010
One-minute read
I’ve got a neat application that I use to map keystrokes to background PowerShell functions / script blocks. I recently started using Pandora more often, and the killer problem is when somebody drops by the office to ask a quick question. You dig around all of your open Explorer windows until you find the one for Pandora, then find the Pause button.
Here’s a function that does all of that for you, and maps it to Control+Alt+P:
function PausePandora
{
$ie = New-Object -Com Shell.Application
$pandora = $ie.Windows() | ? { $_.LocationName -like "*Pandora Radio*" }
if($pandora)
{
$pandora.Navigate2("http://www.pandora.com/#/paused")
}
$ie = $null
}
## Pause Pandora
$keyMapping['Control,Alt,P'] = @{ Action = { PausePandora } }