Click here to Skip to main content
Click here to Skip to main content
Go to top

How AutoHotKey saved the (Visual Studio) day

, 5 Mar 2013
Rate this:
Please Sign up or sign in to vote.
Lance Hilliard has created a AutoHotKey script to effectively disable the Ctrl-Shift-S keyboard shortcut for Lync.

Most of my development time is spent using Visual Studio, and I have grown quite attached to many of the keyboard shortcuts. Specifically, the “Save All” shortcut. By default, this is mapped to the hotkey combination, CTRL+SHIFT+S. I hit this shortcut all the time….like, every time I stop typing and definitely before I build.

For many years, I’ve done this with no particularly bad side effects. That is until Microsoft Communicator became Microsoft Lync and overrides the Ctrl-Shift-S keyboard shortcut.

The problem

I frequently use Microsoft Lync to share my desktop with remote workers or vice-versa. This works pretty well and is reliable. However, hitting Ctrl-Shift-S during a Lync sharing session will end the sharing session without any hesitation or confirmation. This wouldn’t be so bad if it only took effect when the Lync window is active, but that’s not the case. It’s registered globally, so the sharing is killed when I’m just trying to Save-All in Visual Studio.

There’s another unfortunate side effect where if you’re in control of a remote sharing session, and you hit Ctrl-Shift-S, not only will you end the sharing session, but you’ll also leave the remote computer’s keyboard in an unusable state. What happens is that the Ctrl and/or Shift key gets logically stuck in pressed state. So anything the remote user (that you’ve been disconnected from) tries to do with keyboard executes as if the user is holding down the Ctrl and/or Shift key. As you can imagine this causes all sorts of of undesirable side-effects.

By the way, the fix for the stuck keyboard is to have the user press the Ctrl key, release, press Shift key, release.

The fix

Lance Hilliard has created a AutoHotKey script to effectively disable the Ctrl-Shift-S keyboard shortcut for Lync.

I don’t use AutoHotKey regularly, so I created a standalone exe from Lance’s script and I just keep it running in the background.

This turned out to be an easy task. Steps to follow:

  1. Download the AllowSaveAllInVisualStudioWhenLyncScreenSharingIsBeingUsed.ahk script from Lance’s github store
  2. You’ll need to use the Ahk2Exe utility, so download it if necessary. If you’re already using AutoHotKey, you probably already have it in the Compiler folder in your AutoHotKey install directory.
  3. From a command-line prompt, use the Ahk2Exe.exe utility to convert the script into a standalone exe.
    Here’s the command I used – you’ll need to adjust your paths accordingly:
  4. Ahk2Exe.exe /in "..\Extras\Scripts\AllowSaveAllInVisualStudioWhenLyncScreenSharingIsBeingUsed.ahk" 
  5. Now just launch the newly-created exe and let it run in the background.

Conclusion

I have used this solution for a while with no issues. I use Visual Studio keyboard shortcuts extensively, but I don’t really use the Lync shortcuts at all. That makes this a perfect solution for me. If you have any ideas for improvement, well, that’s probably why it’s on GitHub, so go ahead, fork and commit to your heart’s content!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Joseph (landofjoe.com)

United States United States
No Biography provided

Comments and Discussions

 
QuestionGood tip Pinmemberssampath5-Mar-13 16:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140905.1 | Last Updated 5 Mar 2013
Article Copyright 2013 by Joseph (landofjoe.com)
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid