我有一个Kiosk,谷歌Chrome浏览器在启动时运行。但是当它启动时它不起作用,除非在中心生成左键单击(因为Google Chrome错误)。我试过跟随,但它不起作用。
如何告诉屏幕中心并单击左键(不是右键单击)。
Set WshShell = wscript.createobject("Wscript.Shell")
WshShell.SendKeys("+{F10}")
编辑:runme.bat
timeout 10 > nul
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --kiosk
编辑:centerme.vbs
(失败)
set a = createobject("wscript.shell")
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Sub someSub()
dim someX as Long, someY as Long
someX = 400
someY = 400
SetCursorPos someX, someY
End Sub
wscript.quit
答案 0 :(得分:1)
如果你这样试试?
Option Explicit
Dim ws
set ws = CreateObject("wscript.shell")
wscript.sleep 10000
ws.run "chrome.exe --kiosk"
答案 1 :(得分:1)
VBScript不允许移动鼠标光标或应用鼠标点击。 " VBScript"您发布的代码是VB / VBA代码,在VBScript中不起作用。您需要AutoIt之类的内容来处理您尝试做的事情。
答案 2 :(得分:0)
昨天我自己遇到了这个“左键单击”问题。 解决方案是启用Windows“鼠标键”功能,以便您不仅可以左右移动鼠标光标,还可以单击鼠标左键:
set WshShell = WScript.CreateObject("WScript.Shell")
“启用鼠标键
WshShell.SendKeys "{%}{+}{NUMLOCK}"
WScript.Sleep 500
'确认启用
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
“在Windows 10中左键单击
WshShell.SendKeys "{\}"
“在Windows 7中左键单击
WshShell.SendKeys "{Pad5}" (might also be just, "{5}" )