Simulate input/Keyboard: Difference between revisions

Content added Content deleted
Line 401: Line 401:
=={{header|PowerShell}}==
=={{header|PowerShell}}==
The Start-Sleep CmdLet must be used because no application loads instantaneously. The -Milliseconds parameter should be
The Start-Sleep CmdLet must be used because no application loads instantaneously. The -Milliseconds parameter should be
adjusted accordingly for every individual application.
adjusted accordingly for every application.
<lang PowerShell>
<lang PowerShell>
Add-Type -AssemblyName Microsoft.VisualBasic
Add-Type -AssemblyName Microsoft.VisualBasic
Line 407: Line 407:
calc.exe
calc.exe
Start-Sleep -Milliseconds 300
Start-Sleep -Milliseconds 300

[Microsoft.VisualBasic.Interaction]::AppActivate(“Calc”)
[Microsoft.VisualBasic.Interaction]::AppActivate(“Calc”)
[System.Windows.Forms.SendKeys]::SendWait(“2{ADD}2=”)
[System.Windows.Forms.SendKeys]::SendWait(“2{ADD}2=”)