Autohotkey script to exit VMWare window

Russell's answer gets you a large chunk of the way there using RDP as an example. It's a little harder to detect that you're in vsphere/vmware console but can be done with the below. I've commented the changes/additions

#UseHook
#SingleInstance force

; A window's title can contain WinTitle anywhere inside it to be a match
SetTitleMatchMode, 2

setTimer, windowWatch, 500

windowWatch:
  ; if rdp OR (partial title matching vsphere AND you are in the console captured section)
  if WinActive("ahk_class TscShellContainerClass") or (WinActive(" - vSphere Client") and Control("MKSEmbedded1")) {
    if (!active) {
      active := true
      Sleep 50
      suspend off
    }
  } else {
    active := false
    suspend on
  }
return

; return ClassNN of mouse position
Control(ClassNN) { 
    MouseGetPos,,,,control 
    return (ClassNN = control) 
}

I use this to allow play/pause media keys to work in both rdp/vsphere

Media_Play_Pause::
  Sleep 50
  Run "C:\Foobar2000\foobar2000.exe" /playpause
return

Try this in your AHK script:

send ^!{LShift}{RShift} ; send ctrl+alt+left shift+right shift

VMWare is most likely installing its own keyboard hook which takes precedence over AHK's. The same problem occurs when running a Remote Desktop client. The solution is to check whether the target window is active every so often and reinstall AHK's hook if it is. The hook can be reinstalled by suspending and then unsuspending AHK.

Here's my script for Remote Desktop that should be easily customizable for VMWare:

; Script by Russell Davis, http://russelldavis.blogspot.com/
; with inspiration from http://www.autohotkey.com/forum/topic5702.html
; and http://www.autohotkey.com/forum/topic1662.html

#UseHook
#SingleInstance force

setTimer, windowWatch, 500

windowWatch:
  if WinActive("ahk_class TscShellContainerClass") {
    if (!active) {
      active := true
      ; Short sleep to make sure remote desktop's hook is in place first
      Sleep 50
      ; Coming out of suspend mode recreates the keyboard hook, giving
      ; our hook priority over the remote desktop client's.
      suspend off
    }
  } else {
    active := false
    suspend on
  }
return


; Be careful if using a hotkey with an Alt or Win modifier. The modifier's
; keyup event may trigger a system action. AHK is supposed to work around this,
; but it doesn't seem to work in this case.
; See http://www.autohotkey.com/forum/topic22378.html for a related discussion.
^+CapsLock::
  ; Need a short sleep here for focus to restore properly.
  Sleep 50
  WinMinimize ahk_class TscShellContainerClass
return