Script below will use SendKeys in PowerShell, the old fashioned way.
Script below will open a Notepad and type or send some string to notepad.
It will also open windows calculator and do some calculation.
Here's the script:
#====================================
$wshell = New-Object -ComObject Wscript.Shell
#Call notepad and run it
$wshell.Run("notepad")
#Delay for 1 second
Start-Sleep -m 1000
#Send keys to notepad
$wshell.SendKeys("123 test 456")
#Delay for 2 seconds
Start-Sleep -m 2000
#Run Windows Calculator
$wshell.Run("calc")
#Set the window focus to calculator
#Don't click or press the keyboard or mouse so focus will not be changed
$wshell.appactivate("Calculator")
#sleep again for 1 second
Start-Sleep -m 1000
#Do the calculation by sending keys to calculator
$wshell.SendKeys("5")
$wshell.SendKeys("*")
$wshell.SendKeys("5")
$wshell.SendKeys("=")
#====================================
Cheers..Have fun with PowerShell..
----------------------------------
Free Android app, download at Google play:
Android Divine Mercy Chaplet Guide
https://play.google.com/store/apps/details?id=com.dmercyapp
Comments
Post a Comment