Last active
November 1, 2022 02:47
-
-
Save fiddyschmitt/7b4fbdcbecc2311b17d6663b2beeda24 to your computer and use it in GitHub Desktop.
Send hotkey using powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms") | |
| # For some reason, the hotkey has to be sent multiple times | |
| for ($i = 0; $i -lt 10; $i++) | |
| { | |
| #Ctrl + Alt + Shift + s | |
| [System.Windows.Forms.SendKeys]::SendWait("^%+s") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | |
| Register-EngineEvent PowerShell.Exiting -SupportEvent -Action { StopOBSRecording; } | |
| while ($true) | |
| { | |
| Start-Sleep -s 1 | |
| } | |
| Function StopOBSRecording() | |
| { | |
| Write-Host "Stopping OBS recording..." | |
| # For some reason, the hotkey has to be sent multiple times | |
| for ($i = 0; $i -lt 10; $i++) | |
| { | |
| #Ctrl + Alt + Shift + S | |
| [System.Windows.Forms.SendKeys]::SendWait("^%+s") | |
| } | |
| Write-Host "Finished." | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment