vbscript SendKey - vbscript

I have a process I need to run which can only be run by shortcut keys which are CTRL+ALT+RIGHT SHIFT
To make it easier for users I would like to create a desktop shortcut to click on to run this shortcut.
The way I thought this could be done is by vbs script sendkey.
Am I right in my research to say that right shift key can not be specified?
I know there is ^% for CTRL and ALT and + for generic shift but that does not work for right shift.
Is there a way for me to do this?

I recommend that you use AutoHotkey.
It has a very robust, proven "sendkey" functionality, including the ability to send right shift.
Your script would simply be:
SendInput,^!{RSHIFT}
Furthermore, it comes with a utility that will compile the script into a .exe, which is what you'd want to use on the desktop.

I use my own open source software "sendkeys v0.0.1" for this. You can compile it as a C# console application in Visual Studio 2013.
Source: Sendkey v0.0.1
Then use it in a command window like this:
Sendkey CONTROL down
Sendkey MENU down
Sendkey RSHIFT down
Sendkey CONTROL up
Sendkey MENU up
Sendkey RSHIFT up
Or in vbscript using the .Exec() method.
(N.B. command window is Microsoft slang for 'terminal' or 'console')

Related

how do I create a program in windows that can be activated by pressing short cut key instead of clicking?

I need to create a GUI working on windows that can be activated by pressing short cuts.
1. is it possible without setup class?
2. if not possible, just achieve pressing hotkeys and activate my program--how should i code it out--would be enough
thanks (I am using Qt for vs2012 add in to do the GUI)
I put some code up that starts a thread that does this. It is windows specific, but it does the job.
Clipboard Shortcut/Hotkey binding with Qt outside of application
One alternative to all of this, is to go to a shortcut to your program, go to its Properties, and then click on the shortcut area and type your desired shortcut. As long as it doesn't overlap with existing hotkeys that are registered in windows, it should work, without a hidden presence of your app in the system tray or some other background thread.
Hope that helps.
libqxt offers a QxtGlobalShortcut class that does what you want.

a basic keystroke map

I downloaded AutoHotKey today and read the tutorial. What I want to do is have an F2 key do a shift-ctrl-S in one application. I cannot figure out how to do that by reading the tutorial. How can I do it?
Firstly, install autohotkey on your system.
Once installed, create a text file and save it as .ahk (rather than .txt).
Within the file, at the end, type the following code:
F2::Send +^s
Save the file then double click it to run the program.
This will change F2 to your shift-control-s in ALL applications.
To make it application-specific, when running, right click on the icon in the taskbar and choose "Windows Spy". Click into the application you want to use the F2 shortcut in and make a note of the line just below >>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
Now, change your script to this:
#IfWinActive INSERTWindowsSpyWindowTitleHERE
F2::Send +^s
#IfWinActive
Obviously making sure to change INSERTWindowsSpyWindowTitleHERE to what you got from windows spy.
Save and run your script. Autohotkey will now only make F2 do that shortcut when the window (found via Windows spy) is active. (The last #IfWinActive is used to "reset" checking for that window in code below where this is typed - useful if you're going to type more autohotkey code in the future)

Assign VBS Script to a Keyboard Shortcut

I have a very basic VBS script that I plan on using frequently on my Windows 7 machine. Is there any way I can bind it to a keyboard shortcut so I don't have to navigate to it through Explorer obnoxiously.
I realize this question does not directly pertain to programming, or even scripting for that matter, but I could not find a straight answer online or through my own experimentation. I'm sure that there is a simple solution somewhere...
Thank you for taking the time to read, and hopefully respond to my inquiry.
Evin Ugur.
Windows does have built-in support for shell shortcut keys, where a keypress is used to invoke an *.lnk file that launches your VBScript (using either cscript or wscript).
Create a shortcut file, have it invoke your VBScript file directly or run cscript or wscript with the appropriate arguments, then save it and open its Properties sheet and set a keystroke in the "Shortcut key" field (I suggest something like Ctrl+Alt+K).
Like so:
Then, whenever you press Ctrl+Alt+K, regardless of the active application, your script will be invoked.
A more heavy-duty alternative is AutoHotKey: http://www.autohotkey.com/
Just as an FYI.
I tried this and I was not able to register the hotkey when I had the Icon in a costume folder. Even if I added the hotkey, it failed to work.
Once I moved the icon to the "C:\ProgramData\Microsoft\Windows\Start Menu\Programs", the hotkey started to work.

Script to remove hotkey for internet-shortcut in windows

Everytime I start my computer the login-scripts create a shortcut in the start menu which also defines a hotkey for it. Unfortunately this hotkey collides with one of the default eclipse hotkeys so every morning I manually remove the hotkey from the shortcut.
Deleting or manipulating the shortcut doesn't remove the hotkey as well.
So how can the hotkey be removed with a script?
To be precise the shortcut is a shortcut to an URL. The file has the suffix .url.
The structure of the file seems to be an basic windows info file:
[InternetShortCut]
URL=http://...
...
Hotkey=1620
...
I am using Windows XP.
maybe some tweaking on the msconfig's startup and services tab can do some help

how to Create my own shortcut key as Ctrl Alt Del

I need to create my own shortcut key, as in when we press Ctrl + Alt + Delete we get the task manager, likewise i need to click some other 2 keys to execute my program.
How should i do this ?
and also i need to know what language i need to program this?
I am using Windows Vista as my OS.
I think what he means is he wants to be able to create shortcut keys in his application.
If you're using Visual Studio, you can do this through the visual designer in menu options.
Anyways, I hope this article sheds some light onto the situation:
http://support.microsoft.com/kb/839201
You tagged vb, and this article explains it in VB as well as C#.
Good luck.
I think you want to use a hotkey under AutoHotKey to run another program. Once you have an autohotkey script running, you can also add keys to perform actions within that program, set up other keys to launch other programs, etc. See entries under StackOverflow's 'autohotkey' tag and other help pages referred to from those links.
Create a shortcut that performs the Ctrl-Alt-Del action for you
(very useful in environments where OSK is not accessible). Create a shortcut to the following:
C:\Windows\explorer.exe shell:::{2559a1f2-21d7-11d4-bdaf-00c04f60b9f0}
Double-click that shortcut to access the Ctrl-Alt-Del screen. Now you can forget about the inception through multiple RDP.

Resources