Integration of AHK script and Japanese IME

Get help with using AutoHotkey and its commands and hotkeys
cyn
Posts: 2
Joined: 26 Sep 2019, 01:32

Integration of AHK script and Japanese IME

26 Sep 2019, 01:56

Hello AHK community,

This is definitely a stretch, but do you think you can help solve the following problem: How can I run the below script, while in the Japanese IME environment?

The script below uses the CapsLock as a modifier to convert the IJKL keys into arrow keys, among other navigational shortcuts. However, while in the Japanese IME, pressing CapsLock converts my input from Japanese into English.
I've already gone into "Advanced Settings for Microsoft IME", and edited the "Editing operation and behavior" so all CapsLock related operations have been deleted.
https://imgur.com/a/uwMRIHU
After this edit, holding CapsLock no longer converts my input from English to Japanese; however, the AHK navigational shortcuts still do not work.

I can see potentially having AHK override the IME, but are there any other potential solutions that the community knows of?

Thanks!

Code is below:

Code: Select all


#NoTrayIcon

SetCapsLockState, AlwaysOff
CapsLock::return

PrintScreen::AppsKey
; +F10::PrintScreen

CapsLock & i::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Up}
    else if GetKeyState("Alt", "D")
        Send +!{Up}
    else
        Send +{Up}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Up}
    else
        Send !{Up}
else if GetKeyState("Ctrl", "D")
    Send ^{Up}
else
    Send {Up}
return

CapsLock & k::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Down}
    else if GetKeyState("Alt", "D")
        Send +!{Down}
    else
        Send +{Down}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Down}
    else
        Send !{Down}
else if GetKeyState("Ctrl", "D")
    Send ^{Down}
else
    Send {Down}
return

CapsLock & j::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Left}
    else if GetKeyState("Alt", "D")
        Send +!{Left}
    else
        Send +{Left}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Left}
    else
        Send !{Left}
else if GetKeyState("Ctrl", "D")
    Send ^{Left}
else
    Send {Left}
return

CapsLock & l::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Right}
    else if GetKeyState("Alt", "D")
        Send +!{Right}
    else
        Send +{Right}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Right}
    else
        Send !{Right}
else if GetKeyState("Ctrl", "D")
    Send ^{Right}
else
    Send {Right}
return

CapsLock & h::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Home}
    else if GetKeyState("Alt", "D")
        Send +!{Home}
    else
        Send +{Home}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Home}
    else
        Send !{Home}
else if GetKeyState("Ctrl", "D")
    Send ^{Home}
else
    Send {Home}
return

CapsLock & n::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{End}
    else if GetKeyState("Alt", "D")
        Send +!{End}
    else
        Send +{End}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{End}
    else
        Send !{End}
else if GetKeyState("Ctrl", "D")
    Send ^{End}
else
    Send {End}
return

CapsLock & u::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{PgUp}
    else if GetKeyState("Alt", "D")
        Send +!{PgUp}
    else
        Send +{PgUp}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{PgUp}
    else
        Send !{PgUp}
else if GetKeyState("Ctrl", "D")
    Send ^{PgUp}
else
    Send {PgUp}
return

CapsLock & o::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{PgDn}
    else if GetKeyState("Alt", "D")
        Send +!{PgDn}
    else
        Send +{PgDn}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{PgDn}
    else
        Send !{PgDn}
else if GetKeyState("Ctrl", "D")
    Send ^{PgDn}
else
    Send {PgDn}
return


User avatar
YoucefHam
Posts: 344
Joined: 24 Aug 2015, 12:56
Facebook: https://fb.me/YoucefHamDz
Google: [email protected]
GitHub: YoucefHam
Location: Algeria
Contact:

Re: Integration of AHK script and Japanese IME

26 Sep 2019, 05:54

try this

Code: Select all

#NoTrayIcon

SetCapsLockState, AlwaysOff
CapsLock::return

PrintScreen::AppsKey
; +F10::PrintScreen
 
CapsLock & VK49::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Up}
    else if GetKeyState("Alt", "D")
        Send +!{Up}
    else
        Send +{Up}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Up}
    else
        Send !{Up}
else if GetKeyState("Ctrl", "D")
    Send ^{Up}
else
    Send {Up}
return

CapsLock & VK4B::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Down}
    else if GetKeyState("Alt", "D")
        Send +!{Down}
    else
        Send +{Down}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Down}
    else
        Send !{Down}
else if GetKeyState("Ctrl", "D")
    Send ^{Down}
else
    Send {Down}
return

CapsLock & VK4A::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Left}
    else if GetKeyState("Alt", "D")
        Send +!{Left}
    else
        Send +{Left}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Left}
    else
        Send !{Left}
else if GetKeyState("Ctrl", "D")
    Send ^{Left}
else
    Send {Left}
return

CapsLock & VK4C::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Right}
    else if GetKeyState("Alt", "D")
        Send +!{Right}
    else
        Send +{Right}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Right}
    else
        Send !{Right}
else if GetKeyState("Ctrl", "D")
    Send ^{Right}
else
    Send {Right}
return

CapsLock & VK48::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Home}
    else if GetKeyState("Alt", "D")
        Send +!{Home}
    else
        Send +{Home}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Home}
    else
        Send !{Home}
else if GetKeyState("Ctrl", "D")
    Send ^{Home}
else
    Send {Home}
return

CapsLock & VK4E::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{End}
    else if GetKeyState("Alt", "D")
        Send +!{End}
    else
        Send +{End}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{End}
    else
        Send !{End}
else if GetKeyState("Ctrl", "D")
    Send ^{End}
else
    Send {End}
return

CapsLock & VK55::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{PgUp}
    else if GetKeyState("Alt", "D")
        Send +!{PgUp}
    else
        Send +{PgUp}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{PgUp}
    else
        Send !{PgUp}
else if GetKeyState("Ctrl", "D")
    Send ^{PgUp}
else
    Send {PgUp}
return

CapsLock & VK4F::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{PgDn}
    else if GetKeyState("Alt", "D")
        Send +!{PgDn}
    else
        Send +{PgDn}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{PgDn}
    else
        Send !{PgDn}
else if GetKeyState("Ctrl", "D")
    Send ^{PgDn}
else
    Send {PgDn}
return

:wave: There is always more than one way to solve a problem. ;)
cyn
Posts: 2
Joined: 26 Sep 2019, 01:32

Re: Integration of AHK script and Japanese IME

26 Sep 2019, 19:19

Thanks for the response! It still does not seem like it works, and the inputs are Japanese characters:
いjkぃjkぃjkぃjkl
YoucefHam wrote:
26 Sep 2019, 05:54
try this

Code: Select all

#NoTrayIcon

SetCapsLockState, AlwaysOff
CapsLock::return

PrintScreen::AppsKey
; +F10::PrintScreen
 
CapsLock & VK49::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Up}
    else if GetKeyState("Alt", "D")
        Send +!{Up}
    else
        Send +{Up}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Up}
    else
        Send !{Up}
else if GetKeyState("Ctrl", "D")
    Send ^{Up}
else
    Send {Up}
return

CapsLock & VK4B::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Down}
    else if GetKeyState("Alt", "D")
        Send +!{Down}
    else
        Send +{Down}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Down}
    else
        Send !{Down}
else if GetKeyState("Ctrl", "D")
    Send ^{Down}
else
    Send {Down}
return

CapsLock & VK4A::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Left}
    else if GetKeyState("Alt", "D")
        Send +!{Left}
    else
        Send +{Left}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Left}
    else
        Send !{Left}
else if GetKeyState("Ctrl", "D")
    Send ^{Left}
else
    Send {Left}
return

CapsLock & VK4C::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Right}
    else if GetKeyState("Alt", "D")
        Send +!{Right}
    else
        Send +{Right}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Right}
    else
        Send !{Right}
else if GetKeyState("Ctrl", "D")
    Send ^{Right}
else
    Send {Right}
return

CapsLock & VK48::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{Home}
    else if GetKeyState("Alt", "D")
        Send +!{Home}
    else
        Send +{Home}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{Home}
    else
        Send !{Home}
else if GetKeyState("Ctrl", "D")
    Send ^{Home}
else
    Send {Home}
return

CapsLock & VK4E::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{End}
    else if GetKeyState("Alt", "D")
        Send +!{End}
    else
        Send +{End}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{End}
    else
        Send !{End}
else if GetKeyState("Ctrl", "D")
    Send ^{End}
else
    Send {End}
return

CapsLock & VK55::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{PgUp}
    else if GetKeyState("Alt", "D")
        Send +!{PgUp}
    else
        Send +{PgUp}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{PgUp}
    else
        Send !{PgUp}
else if GetKeyState("Ctrl", "D")
    Send ^{PgUp}
else
    Send {PgUp}
return

CapsLock & VK4F::
if GetKeyState("Shift", "D")
    if GetKeyState("Ctrl", "D")
        Send +^{PgDn}
    else if GetKeyState("Alt", "D")
        Send +!{PgDn}
    else
        Send +{PgDn}
else if GetKeyState("Alt", "D")
    if (GetKeyState("Ctrl", "D"))
        Send !^{PgDn}
    else
        Send !{PgDn}
else if GetKeyState("Ctrl", "D")
    Send ^{PgDn}
else
    Send {PgDn}
return


Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], boiler, Google [Bot], keylo, mikeyww, roonyroox, RubbeH, songdg and 49 guests