Created
March 25, 2022 19:26
-
-
Save mavericksevmont/1c79278781f22787dd44c9d74827327d to your computer and use it in GitHub Desktop.
This file contains 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
function Do-SendKeys { | |
param ( | |
$SENDKEYS, | |
$WINDOWTITLE | |
) | |
$wshell = New-Object -ComObject wscript.shell | |
IF ($WINDOWTITLE) {$wshell.AppActivate($WINDOWTITLE)} | |
Start-Sleep -Milliseconds 500 | |
IF ($SENDKEYS) {$wshell.SendKeys($SENDKEYS)} | |
} | |
start calc | |
Start-Sleep -Milliseconds 500 | |
Do-SendKeys -WINDOWTITLE 'Calculator' -SENDKEYS '2' | |
Start-Sleep -Milliseconds 500 | |
Do-SendKeys -WINDOWTITLE 'Calculator' -SENDKEYS '{+}' | |
Start-Sleep -Milliseconds 500 | |
Do-SendKeys -WINDOWTITLE 'Calculator' -SENDKEYS '2' | |
Start-Sleep -Milliseconds 500 | |
Do-SendKeys -WINDOWTITLE 'Calculator' -SENDKEYS '{ENTER}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment