VBScript sendkeys,尝试执行CTRL + ALT + A [英] VBScript sendkeys, Trying to do CTRL+ALT+A
问题描述
我正在我们的学校董事会中测试Lexibar软件的语音合成功能。
这种软件旨在帮助学习困难的学生,因此我需要编写一个模拟 Ctrl + Alt + A的VBS文件。
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 "^%{a}"
- "^%a"
- "^%{A}"
- "^%A"
- "^(%a)"
- "^(%(a))"
- ... (But nothing worked)
如果我尝试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:\Lexibar\SendKeys.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 sendkeys,尝试执行CTRL + ALT + A的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!