Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
572 B
4
Indexable
Never
while ($true) {
    # Send the "Next Track" media key to Spotify
    Add-Type -TypeDefinition @"
    using System;
    using System.Runtime.InteropServices;
    public class MediaControl {
        [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
        public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, IntPtr dwExtraInfo);
    }
"@

    [MediaControl]::keybd_event(0xB0, 0, 0, [IntPtr]::Zero) # 0xB0 is the virtual key code for "Next Track"

    # Wait for 30 seconds
    Start-Sleep -Seconds 30
}
Leave a Comment