VBScript 发送键,尝试执行 CTRL+ALT+A [英] VBScript sendkeys, Trying to do CTRL+ALT+A
问题描述
我正在学校董事会中测试用于语音合成的 Lexibar 软件.这种软件是为了帮助有学习困难的学生设计的,所以我需要写一个VBS文件来模拟Ctrl+Alt+A.
I'm testing Lexibar software for voice synthesis in our schoolboard. This kind of software is design to help students who have learning difficulty so I need to write a VBS file that simulate the Ctrl+Alt+A.
我试过:
- wshshell.sendkeys "^%{a}"
- "^%a"
- "^%{A}"
- "^%A"
- "^(%a)"
- "^(%(a))"
- ...(但没有任何效果)
如果我尝试 wshshell.sendkeys "^%{down}" -> 屏幕旋转但我无法发送 Ctrl+Alt+A.
If I try wshshell.sendkeys "^%{down}" -> the screen rotate but I am not able to send Ctrl+Alt+A.
是否被阻止(Ctrl+Alt+Del被阻止).
Is it blocked (Ctrl+Alt+Del is blocked).
推荐答案
我现在使用 powershell,效果很好.使用 VBS,它工作一次,然后停止工作.这是我运行的代码:
I now use powershell and it work great. With VBS, it worked once and then it stoped working. This is the code I run:
[void][reflection.assembly]::loadwithpartialname("system.windows.forms")
[system.windows.forms.sendkeys]::sendwait("^%a")
我使用 PS2EXE 0.5.1 将脚本转换为 exe(SendKeys.exe),然后我从这段代码运行它:
I used PS2EXE 0.5.1 to convert the script to a exe (SendKeys.exe), then I run it from this code:
Set wshShell = WScript.CreateObject("WScript.Shell")
wshShell.run "C:LexibarSendKeys.exe",0
我需要从 vbs 运行它以避免弹出窗口.我使用 Vbs_To_exe 来转换这个,现在它可以工作了.(转换为 .exe 只是为了安全,对学生隐藏我的代码)
I need to run it from a vbs to avoid windows to pop. I used Vbs_To_exe to convert this one and now it work. (converting to .exe is just for security, hide my code from students)
这篇关于VBScript 发送键,尝试执行 CTRL+ALT+A的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!