[英]Send keys malfunctions for non English keyboards
我有以下代码,它访问特定站点并输入用户名(从 %USERNAME% 获取)。
只要键盘设置为英语,它就可以正常工作,但是,如果键盘设置为另一种语言,它就不能正常工作。
有没有办法从批处理文件更改键盘输入语言或以其他方式解决此问题?
@if (@CodeSection == @Batch) @then
@echo off
rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"
start chrome -new-window --incognito "https://servicedesk.sa.gov.ge/"
rem the script only works if the application in question is the active window. Set a timer to wait for it to load!
timeout /t 3
rem use the tab key to move the cursor to the login and password inputs. Most htmls interact nicely with the tab key being pressed to access quick links.
rem now you can have it send the actual username/password to input box
%SendKeys% "%USERNAME%"
%SendKeys% "{TAB}"
goto :EOF
@end
// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
目前,Windows 不支持此功能,我也尝试在超级用户上找到答案,但目前还没有针对此的现有解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.