/RemoteDesktop.ahk

https://github.com/marvinrodas/AutoHotkey-Scripts · AutoHotKey · 38 lines · 21 code · 6 blank · 11 comment · 3 complexity · 21b798bb72f2bb86686841465564381d MD5 · raw file

  1. ; Script by Russell Davis, http://russelldavis.blogspot.com/
  2. ; with inspiration from http://www.autohotkey.com/forum/topic5702.html
  3. ; and http://www.autohotkey.com/forum/topic1662.html
  4. #UseHook
  5. #SingleInstance force
  6. #NoEnv
  7. ListLines Off
  8. setTimer, windowWatch, 500
  9. windowWatch:
  10. if WinActive("ahk_class TscShellContainerClass") {
  11. if (!active) {
  12. active := true
  13. ; Short sleep to make sure remote desktop's hook is in place first
  14. Sleep 50
  15. ; Coming out of suspend mode recreates the keyboard hook, giving
  16. ; our hook priority over the remote desktop client's.
  17. suspend off
  18. }
  19. } else {
  20. active := false
  21. suspend on
  22. }
  23. return
  24. ; Be careful if using a hotkey with an Alt or Win modifier. The modifier's
  25. ; keyup event may trigger a system action. AHK is supposed to work around this,
  26. ; but it doesn't seem to work in this case.
  27. ; See http://www.autohotkey.com/forum/topic22378.html for a related discussion.
  28. ^+CapsLock::
  29. ; Need a short sleep here for focus to restore properly.
  30. Sleep 50
  31. WinMinimize ahk_class TscShellContainerClass
  32. return