Code: Select all
#InstallKeybdHook
#Persistent
ENUS := 0
Dvorak := 0
CapsCtrl := 0
DisWin := 0
ApKb := 0
ApJPKb := 0
;------------------- Gui Design --------------------
Gui, SettingWindow:New, -Resize -MaximizeBox -MinimizeBox, Layout Setting
Gui, SettingWindow:Add, GroupBox, r2, Layout Selector
Gui, SettingWindow:Add, Radio, xp+10 yp+20 vENUS Checked, Active US English Layout
Gui, SettingWindow:Add, Radio, r1 vDvorak, Active Dvorak Layout
Gui, SettingWindow:Add, GroupBox, r2 xp-10 yp+25, Other Options
Gui, SettingWindow:Add, Checkbox, xp+10 yp+20 vCapsCtrl, Switch CapsLock and Ctrl
Gui, SettingWindow:Add, Checkbox, r1 vDisWin, Disable Win Key
Gui, SettingWindow:Add, Button, xm Default gButtonOK, OK
Gui, SettingWindow:Show, AutoSize Center
Menu, Tray, NoStandard
Menu, Tray, Add, Layout Setting, ChangeSetting
Menu, Tray, Add
Menu, Tray, Add, Exit, ExitScript
Return
;------------------- Gui Control --------------------
GuiClose:
GuiEscape:
ButtonOK:
Gui, SettingWindow:Submit
MsgBox ENUS %ENUS%`nDvorak %Dvorak%`nCapsCtrl %CapsCtrl%`nDisWin %DisWin%`nApKb %ApKb%`nApJPKb %ApJPKb% ; only for debug output
Return
;------------------- Tray Menu Control --------------------
ChangeSetting:
Gui, SettingWindow:Show, AutoSize Center
Return
ExitScript:
ExitApp
Return
If (Dvorak = 1) {
MsgBox, , Layout Setting, Dvorak Layout Load!
; DvorakLayout
; QWERTY to Dvorak: - to [; _ to {
SC00C::SC01A
; QWERTY to Dvorak: = to ]; + to }
SC00D::SC01B
; QWERTY to Dvorak: Q to "; q to '
SC010::SC028
; QWERTY to Dvorak: W to <; w to ,
SC011::SC033
; QWERTY to Dvorak: E to >; e to .
SC012::SC034
; QWERTY to Dvorak: R to P; r to p
SC013::SC019
; QWERTY to Dvorak: T to Y; t to y
; More Dvorak Mapping .....
Return
}
I want the code of remapping load only when I checked the Radio "Active Dvorak Layout", but no matter how I tried, the code of remapping always load when the program started running(I am using ahk2exe v1.1.30.03 to compiling the code to an exe).
I already tried to using if expression, labels, functions which did not work at all, because hotkey can not located in functions.
Is there any way to prevent this? And is there any way after the code load dvorak remapping, and then I checked the Radio "Active US English Layout",
I can just unload the code about dvorak remapping in one time, but do no effect to other remapping(like switch "caps and ctrl" and "disable win") which I did not post it above.
And there are any way to make autohotkey work in windows lock screen? After I used the L(R)Win::Return to disable the win key, If I using win+L to lock. Seems the Win key up event can not send to the lock screen, it will cause when you inputting the password with the key P, the system will treat it like win+p, you have to do some win+p to made the system think the win key was up, that is very Annoying.
Thanks a lot.