主要歷史

主要歷史

我想透過使用HenkanKanaHira鍵切換輸入語言,這些是實現的日語鍵盤。

    vk1Csc079::
      PostMessage, 0x50, 0, 0x41E041E,, A ; 0x50 is WM_INPUTLANGCHANGEREQUEST
    Return

    vkF2sc070::
      PostMessage, 0x50, 0, 0x4110411,, A ; 0x50 is WM_INPUTLANGCHANGEREQUEST
    Return

vk1Csc079是 的代碼Henkan,並且vkF2sc070是 的KanaHira。使用此代碼,我可以將鍵盤日語更改為泰語,但無法將泰語向後更改為日語。

我注意到,因為泰語中有另一個鍵映射,所以KanaHira切換後不再存在。

所以我想知道我應該為該功能編寫什麼鍵代碼才能在泰語鍵盤中啟用它。有人知道嗎?

主要歷史

Window: C:\Users\ironsand\Desktop\thai_keyboard.ahk - AutoHotkey v1.1.23.05
Keybd hook: no
Mouse hook: no
Enabled Timers: 0 of 0 ()
Interrupted threads: 0
Paused threads: 0 of 0 (0 layers)
Modifiers (GetKeyState() now) = 
Modifiers (Hook's Logical) = 
Modifiers (Hook's Physical) = 
Prefix key is down: no

NOTE: Only the script's own keyboard events are shown
(not the user's), because the keyboard hook isn't installed.

NOTE: To disable the key history shown below, add the line "#KeyHistory 0" anywhere in the script.  The same method can be used to change the size of the history buffer.  For example: #KeyHistory 100  (Default is 40, Max is 500)

The oldest are listed first.  VK=Virtual Key, SC=Scan Code, Elapsed=Seconds since the previous event.  Types: h=Hook Hotkey, s=Suppressed (blocked), i=Ignored because it was generated by an AHK script, a=Artificial, #=Disabled via #IfWinActive/Exist, U=Unicode character (SendInput).

VK  SC  Type    Up/Dn   Elapsed Key     Window
-------------------------------------------------------------------------------------------------------------
Press [F5] to refresh.

答案1

有些功能會強制安裝鍵盤掛鉤,而其他功能則不會。您的腳本沒有任何強制鍵盤掛鉤的命令,因此它不是全域運行/可用的

請注意日誌檔案的頂部...鍵盤鉤子=否...

Window: C:\Users\ironsand\Desktop\thai_keyboard.ahk - AutoHotkey v1.1.23.05
Keybd hook: no
Mouse hook: no
Enabled Timers: 0 of 0 ()

第二個註釋...

NOTE: Only the script's own keyboard events are shown
(not the user's), because the keyboard hook isn't installed.

為了強制鍵盤掛鉤並查看所有按鍵的擊鍵,您應該能夠在腳本頂部添加#InstallKeybdHookor指令。#UseHook On執行此操作後,您應該能夠轉到按鍵歷史記錄並看到鍵盤掛鉤已啟用。

啟用鍵盤掛鉤並且開啟按鍵歷史記錄視窗後,按下您需要取得其按鍵歷史記錄的按鍵。然而,除非您按下 ,否則它不會出現在視窗中F5,正如 @harrymc 所指出的。

寫完這篇文章,我看到評論多了,你已經懂了。我將為任何其他可能發生的人發布任何方式。

相關內容