I'm using Windows 7 and I'd like to define a custom hotkey to change between different input languages.

I know that I can change them to Ctrl + Shift, Left Alt + Shift or the grave accent, but I don't like either of these. SO is there a way to define something like Ctrl + Space to switch the input language?

link|improve this question
feedback

2 Answers

up vote 1 down vote accepted

I think Windows doesn't natively support changing these keys. Anyway you can write an AutoIt script to listen for custom key bindings and programmatically send one of the predefined keyboard shortcuts to the system to change the keyboard layout.

;^ = Ctrl
;! = Alt
;# = WinKey (Meta)
;+ = Shift

HotKeySet("^{Space}", "change") ;Registers Contorl + Space

;Main loop
While 1
    Sleep(100)
WEnd

;Changes Keyboard Layout
Func change()
    Send ("{ALTDOWN}") ;Hold down Alt
    Sleep(100) ;Wait 100 milliseconds
    Send("{LSHIFT}{ALTUP}") ;Press Left-Shift and release Alt
EndFunc

Just download and install AutoIt and create a file with .au3 extension. Copy and paste the code above and save it. You can place this file into your Startup if you want it to be opened on Windows startup.

Let me know if this instruction needs to be clarified.

link|improve this answer
It's exactly what I wanted, thanks. – Fynn Feb 1 '11 at 14:04
feedback

The script above didn't work for me, but I modified it, and now it does.

#Include <Misc.au3>
;~ #RequireAdmin
;^ = Ctrl
;! = Alt
;# = WinKey (Meta)
;+ = Shift

HotKeySet("^{Space}", "change") ;Registers Contorl + Space
$dll = DllOpen("user32.dll")

ToolTip("Try to use ^Space"&@CRLF&"!!!!!!!!!!!!!!!!!!!")
Sleep(3000)
ToolTip('')

;Main loop
While 1
    Sleep(100)
WEnd

;Changes Keyboard Layout
Func change()
 While _IsPressed("11",$dll)
  Sleep(10)
 WEnd
 Send ("{ALTDOWN}") ;Hold down Alt
    Sleep(100) ;Wait 100 milliseconds
    Send("{LSHIFT}{ALTUP}") ;Press Left-Shift and release Alt
EndFunc
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.