VBScript sendkeys, Trying to do CTRL+ALT+A
24,257
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")
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
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)
Author by
Tommy
Updated on February 18, 2020Comments
-
Tommy about 4 years
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.
I tried :
- wshshell.sendkeys "^%{a}"
- "^%a"
- "^%{A}"
- "^%A"
- "^(%a)"
- "^(%(a))"
- ... (But nothing worked)
If I try wshshell.sendkeys "^%{down}" -> the screen rotate but I am not able to send Ctrl+Alt+A.
Is it blocked (Ctrl+Alt+Del is blocked).
-
Phylogenesis almost 7 yearsYou need to make sure you are sending the keys to the appropriate application. That is, the application needs to have keyboard focus. The other example you showed (changing screen orientation) is captured before sending to any application.
-
GTAVLover almost 7 yearsYou may be able to find the Application Title of the window you want to give focus by looking at "Applications" tab in Windows Task Manager, It can be the main window or any child window of main application.
-
Tommy almost 7 yearsThe application is Windows. It is a keys combination that activate or deactivate Lexibar. Lexibar run in background
-
Tommy almost 7 yearsI already tryed but it didn't worked. And about the application windows, it run in background and the key combination work on any windows
-
GTAVLover almost 7 years@Tommy then do you know what is the executable name of the application?
-
Tommy almost 7 yearsOr, is it different if I use {a} vs {A}?
-
Tommy almost 7 yearsThe process name is Lexibar.exe, the background app is Lexibar Laucher (32 bits)
-
GTAVLover almost 7 yearsThen, as you previously mentioned, Isn't Lexibar has any window that can interact with user (You mean by background)?
-
Tommy almost 7 yearsThere is a param page reachable by the tray icon but it don't work like normal app. When Lexibar is activate, every keyboard typing pop a Word Preacher and a voice synthesis (Word, chrome, search field in startup menu... everywhere)
-
Tommy over 5 yearsIt don't work for Lexibar. The only way is by using Powershell