What's wrong with this language switching script? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
YuvalAmir
Posts: 5
Joined: 09 May 2021, 17:25

What's wrong with this language switching script?

Post by YuvalAmir » 11 May 2021, 05:04

Ok so here is what I am trying to do. I want the keyboard language temperedly to Greek (mainly for math) while holding the menu button, kind of like how the shift key temperedly sets the keyboard to caps. Also, I need to be able to use 2 languages (besides the occasional Greek letter) I need to be able to use two languages, and if I have Greek as one of my languages I also have to cycle through Greek when using alt shift. Here's my code to try to solve this:

Code: Select all

bool := true

!+::
bool := !bool
if (bool) 
    SetInputLang(0x0409) 
else
    SetInputLang(0x040d) 
return

AppsKey::SetInputLang(0x0408)
AppsKey up::
if (bool) 
    SetInputLang(0x0409) 
else
    SetInputLang(0x040d) 
return

SetInputLang(Lang)
{
    WinExist("A")
    ControlGetFocus, CtrlInFocus
    PostMessage, 0x50, 0, % Lang, %CtrlInFocus%
}
The temporarily switch to Greek works perfectly, but the alt shift part does absolutely nothing, even after disabling the alt shift combo in the windows settings.

I am very new to AutoHotKey and I really have no idea what I'm doing wrong.
User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: What's wrong with this language switching script?  Topic is solved

Post by mikeyww » 11 May 2021, 06:51

+ can indicate Shift only in modifying other keys. Try !Shift. If you think of it as a hotkey modifier symbol, it is easy to remember, because the symbol is used only to modify other keys.

Without a key to modify, + as a hotkey represents + on the keyboard.

Code: Select all

!+::MsgBox, I pressed ALT PLUS!
YuvalAmir
Posts: 5
Joined: 09 May 2021, 17:25

Re: What's wrong with this language switching script?

Post by YuvalAmir » 11 May 2021, 07:15

Thank you!!
Post Reply

Return to “Ask for Help (v1)”