; [REQ] Keyboard locale auto-switcher? ; Date: 03/09/2007 ;Last Updated: 09/09/2007 ; Refer: http://www.donationcoder.com/Forums/bb/index.php?topic=9805.0 ; This script assumes Lang1 is the default locale but you can change the locale in the INI file. FileInstall auto-switch.ini, auto-switch.ini #SingleInstance force #Persistent DetectHiddenWindows On SetTitleMatchMode 2 appname=Keyboard locale auto-switcher vernum=1.0 appdesc=Auto switch keyboard locale based on programs. INI_File=auto-switch.ini OnExit, ExitSub Menu, tray, Icon, %A_WinDir%\System32\main.cpl, 8 Menu, tray, Tip, %appname%` - `n%appdesc% ;f0dder's default Lang1=00000406 ;Danish Lang2=00000409 ;English Gosub, Get_INI SetTimer, SwitchLocale, 500 Return ;Source: http://www.autohotkey.com/forum/viewtopic.php?t=9955 SetLayout(Locale) { DllCall("SendMessage", UInt, WinActive("A"), UInt, 80, UInt, 1,UInt, DllCall("LoadKeyboardLayout", Str, %Locale%, UInt, 257)) } Return Get_INI: IfNotExist, %INI_File% { comments= comments=`;For more information about this script, visit the link below: comments=%comments%`n`;http://www.donationcoder.com/Forums/bb/index.php?topic=9805.0 comments=%comments%`n`;This file contains the list of apps to be monitored. comments=%comments%`n`;Separate these processes with a pipe (|) comments=%comments%`n`;More locale code can be found in the web-site below: comments=%comments%`n`;http://www.cryer.co.uk/brian/windows/info_windows_locale_table.htm comments=%comments%`n`; FileAppend,%comments%,%INI_File% IniWrite,%Lang1%,%INI_File%,Settings,DefaultLang IniWrite,%Lang2%,%INI_File%,Settings,AdditionalLang IniWrite,%AppMonitor%,%INI_File%,Settings,MonitorList } Else { IniRead,Lang1,%INI_File%,Settings,DefaultLang IniRead,Lang2,%INI_File%,Settings,AdditionalLang IniRead,AppMonitor,%INI_File%,Settings,MonitorList } Return SwitchLocale: Loop, Parse, AppMonitor, | { IfWinActive, %A_LoopField% { If Not ErrorLevel SetLayout("Lang2") } } ;Sleep, 2000 Return ;Win+Alt+q exits... #!q::ExitApp ;Win+Alt+p pauses... #!p::Pause ExitSub: ; ExitApp