응용 프로그램에 키 입력을 보낼 수있는 다른 방법이 있습니까?Sendkeys Powershell이 제대로 작동하지 않습니다.
콘솔을 응용 프로그램에서 열어야하는 백틱 키를 누른 후에이 Powershell 스크립트를 사용하지만이 경우는 발생하지 않지만 키보드는 phisical 한 방식으로 완벽하게 작동합니다.
본인이 직접 콘솔을 열면 sendkeys는 작동하지만 첫 번째 sendkeys (backtick)가 작동하지 않습니다.
내가 필요한 것은 스크립트가 백틱 키를 보내서 콘솔을 여는 것입니다. 내가 볼
# startpwsscrip.ps1
function wait {
param([int]$stop = 8)
Start-Sleep -seconds $stop
}
[void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
& "$env:C:\Program Files (x86)\Steam\SteamApps\common\Half-Life\cstrike.exe"
$a = Get-Process | Where-Object {$_.Name -eq "Counter-strike"}
wait3
$Cursor = [system.windows.forms.cursor]::Clip
[System.Windows.Forms.Cursor]::Position = New-Object system.drawing.point(509,763)
wait
[System.Windows.Forms.SendKeys]::SendWait({"ENTER"})
wait
[System.Windows.Forms.SendKeys]::SendWait({"`"})
wait
[System.Windows.Forms.SendKeys]::SendWait("connect ")
wait
[System.Windows.Forms.SendKeys]::SendWait("192.168.1.1")
wait
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
이 백틱에 관해서는, 내가 그 버튼을 SendKeys 매크로 어떤 문서 ATM을 찾을 수 없습니다. 그러나 우리가 그것을 어떻게 벗어나야할지에 관해 좋은 읽을 거리가 있습니다. http://www.rlmueller.net/PowerShellEscape.htm –
SendKeys는 지역 설정 (키보드 레이아웃)에 따라 다르므로 다양 할 수 있습니다. Shift 키를 누른 상태에서'\'와 스페이스를 눌러 백틱을 생성합니다. 생성하려면'[System.Windows.Forms.SendKeys] :: SendWait ("+ \")'를 사용하십시오. '+'는 시프트를 누르고 있음을 의미합니다. –