AutoHotKey scripts can do magic, but for now, let's use a script to switch between English and Greek using Caps Lock.
An initial approach would be to reprogram Caps Lock to send Left Alt + Shift, the default language switch combination in Windows. However, I've also got Spanish enabled on my keyboard, and there doesn't seem to be a way to exclude a language when switching.
So here's an alternative approach, which:
- allows selecting each language individually, based on an Left Alt + Shift + number combination,
- enables switching between only a subset of the supported input languages.
Between input languages: (None)
To English (united States) - US: Left Alt + Shift + 0
To Greek (Greece) - Greek: Left Alt + Shift +9
To Spanish (Spain, International Sort) - Spanish: Left Alt + Shift + 8
Since there's no keys to switch languages, an AHK script will have to remember the current input language, and switch to the other one directly. Here's a sample script, using a simple boolean to remember the state:
ingreek = False
CapsLock::
ingreek := not ingreek
OutputDebug, ingreek has become %ingreek%
if ingreek {
OutputDebug, Sending Alt-Shift-9
SendInput, {Lalt Down}{LShift Down}9{LShift Up}{LAlt Up}
} else {
OutputDebug, Sending Alt-Shift-0
SendInput, {Lalt Down}{LShift Down}0{LShift Up}{LAlt Up}
}
CapsLock::
ingreek := not ingreek
OutputDebug, ingreek has become %ingreek%
if ingreek {
OutputDebug, Sending Alt-Shift-9
SendInput, {Lalt Down}{LShift Down}9{LShift Up}{LAlt Up}
} else {
OutputDebug, Sending Alt-Shift-0
SendInput, {Lalt Down}{LShift Down}0{LShift Up}{LAlt Up}
}
So there you have it: you can use Caps Lock to switch between English and Greek, or Left Alt + Shift + 8 to get into Spanish mode directly.
A debugging tip: The OutputDebug call sends output to the system debugger. Download a copy of SysInternals' DebugView, run it with elevated privileges and toggle Capture / Capture Global Win32, to view the debugging output of the script.
thank you! :)
ReplyDelete