;#HotkeyInterval 999999 #MaxHotkeysPerInterval, 999999 #NoEnv ;#NoTrayIcon #Persistent #SingleInstance, Force #InstallKeybdHook ; get tic's gdip lib (x64 recommended for AHK_L and 64bit OS obviously) #Include, Gdip.ahk w=200 h=200 x:=(1920-w)//2 y:=(1080-h)//2 width := w, height := h ;Font=DIN Engschrift Std Font=Alte DIN 1451 Mittelschrift gepraegt ;Font=Alte DIN 1451 Mittelschrift ;Font=DIN Engschrift Std FontSize=224 ; aarrggbb FontColor=ffffffff FontShadowColor=000000 FontNoShadow=0 if (!pToken := Gdip_Startup()) { MsgBox, 48, gdiplus error!, GDIPlus failed to start. Please to have gdiplus on your system. ExitApp } OnExit, Exit Gui, 1: -Caption +E0x80000 +LastFound +ToolWindow +OwnDialogs +AlwaysOnTop Gui, 1: Show, NoActivate, update hwnd1 := WinExist() Menu, Tray, Tip, 60`% Keyboard Layout Menu, Tray, NoStandard Menu, Tray, Add, Exit, Exit CapsLockEnabled := GetKeyState("CapsLock", "T") SetCapsLockState, % (CapsLockEnabled ? "AlwaysOn" : "AlwaysOff") ; ; AHK_L script to remap keyboard to 60% ANSI layout: ; http://mods.neocities.org/kbd60.htm ; (some of them are commented out) ; in order to use this script you must disable win+l somehow. i used ; http://www.howtogeek.com/howto/windows-vista/disableenable-lock-workstation-functionality-windows-l/ ; ; i couldn't figure out to do it without at least 25*16+4*8=432 hotkeys =D ; b= ( `` Esc 1 F1 2 F2 3 F3 4 F4 5 F5 6 F6 7 F7 8 F8 9 F9 0 F10 - NumpadSub = NumpadAdd Backspace Delete q F11 w F12 i Ins p PrintScreen [ ScrollLock ] Pause h Left j Down k Up l Right ) Basic := toArray(b) mods=# + ^ +# ^# ^+ ^+# ! !# !+ !^ !+# !^# !^+ !^+# mods := toList(mods) for from in Basic { Hotkey, $%from%, Fn1, On for _, mod in mods Hotkey, $%mod%%from%, Fn1, On } w= ( h Home j PgDn k PgUp l End ) Win := toArray(w) mods=# +# ^# ^+# !# !+# !^# !^+# mods := toList(mods) for from in Win for _, mod in mods Hotkey, $%mod%%from%, Fn2, On return Fn1: h := parseHotkeyName(A_ThisHotkey) k := h.keys, pre := h.mods if (GetKeyState("CapsLock", "P")) k := Basic[k] if (StrLen(k) > 1) Send, %pre%{%k%} else { if (CapsLockEnabled && InStr("abcdefghijklmnopqrstuvwxyz", k)) { if (InStr(pre, "+")) StringReplace, pre, pre, + else StringUpper, k, k } Send, %pre%%k% } return Fn2: h := parseHotkeyName(A_ThisHotkey) k := h.keys, pre := h.mods StringReplace, pre, pre, # k := Win[k] if (StrLen(k) > 1) Send, %pre%{%k%} else Send, %pre%%k% return CapsLock::return $Tab:: if (GetKeyState("CapsLock", "P")) { CapsLockEnabled := !(CapsLockEnabled) SetCapsLockState, % (CapsLockEnabled ? "AlwaysOn" : "AlwaysOff") GoSub, OSD } Else Send, {Tab} return ;RCtrl::Esc toArray(s) { r := {}, i := 1 while (j := RegExMatch(s, "([^\s]+)\s+([^\s]+)", m, i)) { r[m1] := m2 i := j + StrLen(m) } return r } toList(s) { r := {}, i := 1 while (j := RegExMatch(s, "[^\s]+", m, i)) { r.Insert(m) i := j + StrLen(m) } return r } parseHotkeyName(s) { StringReplace, s, s, $ loop if (!InStr("+^#!", SubStr(s, i := A_Index, 1))) break return { mods: SubStr(s, 1, i-1), keys: SubStr(s, i) } } Exit: Gdip_Shutdown(pToken) ExitApp return drawText(G, x, y, ox, oy, text, color, align, alpha) { global FontSize, Font, Width, Height x += ox, y += oy Options= %align% x%x% y%y% c%alpha%%color% r4 s%FontSize% Gdip_TextToGraphics(G, text, Options, Font, Width, Height) } OSD: output := CapsLockEnabled ? "A" : "a" if (output === prevout) return prevout := output hbm := CreateDIBSection(Width, Height) hdc := CreateCompatibleDC() obm := SelectObject(hdc, hbm) G := Gdip_GraphicsFromHDC(hdc) Gdip_SetSmoothingMode(G, 4) pBrush := Gdip_BrushCreateSolid(0x80000000) ; AARRGGBB order Gdip_FillRoundedRectangle(G, pBrush, 0, 0, width, height, 16) Gdip_DeleteBrush(pBrush) ; SystemDefault = 0 ; SingleBitPerPixelGridFit = 1 ; SingleBitPerPixel = 2 ; AntiAliasGridFit = 3 ; AntiAlias = 4 Gdip_SetTextRenderingHint(G, 4) If (!Gdip_FontFamilyCreate(Font)) { MsgBox, 48, Font error!, The font you have specified does not exist on the system ExitApp } i := 0 texts := [{"text": output, "x":0, "y":-32, align: "Center" }] for _, text in texts { i += 1 if (i > 2) ;and Mod(s, 2) break output := text.text ox := text.x oy := text.y ; NASIOHG sx := ox +1 sy := oy +1 align := text.align /* if (!FontNoShadow) { ; poor bro's shadowing drawtext(G, sx, sy, 1, 0, output, FontShadowColor, align, 40) drawtext(G, sx, sy, 0, 1, output, FontShadowColor, align, 40) drawtext(G, sx, sy, -2, 0, output, FontShadowColor, align, 10) drawtext(G, sx, sy, 0, -2, output, FontShadowColor, align, 10) drawtext(G, sx, sy, 2, 0, output, FontShadowColor, align, 10) drawtext(G, sx, sy, 0, 2, output, FontShadowColor, align, 10) ;drawtext(G, sx, sy, -1, -1, output, FontShadowColor, align, 20) ; no need because under original text according to NASIOHG drawtext(G, sx, sy, 1, -1, output, FontShadowColor, align, 20) drawtext(G, sx, sy, -1, 1, output, FontShadowColor, align, 20) drawtext(G, sx, sy, 1, 1, output, FontShadowColor, align, 20) ;drawtext(G, sx, sy, -2, -2, output, FontShadowColor, align, 10) ;drawtext(G, sx, sy, 2, -1, output, FontShadowColor, align, 10) } */ drawtext(G, ox, oy, 0, 0, output, FontColor, align, "ff") } Gui, 1: +AlwaysOnTop UpdateLayeredWindow(hwnd1, hdc, X, Y, Width, Height) SelectObject(hdc, obm) DeleteObject(hbm) DeleteDC(hdc) Gdip_DeleteGraphics(G) SetTimer, Clear, -750 return Clear: hbm := CreateDIBSection(Width, Height) hdc := CreateCompatibleDC() obm := SelectObject(hdc, hbm) G := Gdip_GraphicsFromHDC(hdc) UpdateLayeredWindow(hwnd1, hdc, X, Y, Width, Height) SelectObject(hdc, obm) DeleteObject(hbm) DeleteDC(hdc) Gdip_DeleteGraphics(G) return