From 3fdde73417df2063076102e0ef9cfd80f329267e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 18 Jan 2021 16:58:50 +0100 Subject: programs.kompozer: Use NumLock for ToC macros --- tt.programs.kompozer.ahk | 80 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 19 deletions(-) (limited to 'tt.programs.kompozer.ahk') diff --git a/tt.programs.kompozer.ahk b/tt.programs.kompozer.ahk index 69637dc..fb72c68 100644 --- a/tt.programs.kompozer.ahk +++ b/tt.programs.kompozer.ahk @@ -1,6 +1,10 @@ +;; -> init + +GroupAdd, KompoZer, ahk_exe kompozer.exe ahk_class MozillaUIWindowClass + ;; -> body -#IfWinActive ahk_exe kompozer.exe ahk_class MozillaUIWindowClass +#IfWinActive ahk_group KompoZer ^q::SendInput, !vd ; design ^w::SendInput, !vs ; split @@ -44,22 +48,37 @@ F1:: ; open advanced properties for tag MouseGetPos, mx, my WinGetPos,,, w, h MouseMove, % w - 40, % h - 20, 0 -SendInput, {RButton}{Up}{Enter} +SendInput, {RButton} MouseMove, % mx, % my, 0 +SendInput, {Up}{Enter} return F2:: ; open inline styles for tag MouseGetPos, mx, my WinGetPos,,, w, h MouseMove, % w - 40, % h - 20, 0 -SendInput, {RButton}{Up}{Up}{Enter} +SendInput, {RButton} MouseMove, % mx, % my, 0 +SendInput, {Up}{Up}{Enter} return +#IfWinActive Rubber dome keyboard buyer's guide ahk_group KompoZer + +;; -> library + +CounterRD() +{ + static clicks := 0 + clicks += 1 + return clicks +} + +;; -> body + F8:: ; class=left MouseGetPos, mx, my WinGetPos,,, w, h -if (Counter() & 1) ; odd +if (CounterRD() & 1) ; odd MouseMove, % w - 40, % h - 25, 0 else MouseMove, % w - 40, % h - 15, 0 @@ -70,7 +89,7 @@ return F9:: ; class=clear MouseGetPos, mx, my WinGetPos,,, w, h -if (Counter() & 1) ; odd +if (CounterRD() & 1) ; odd MouseMove, % w - 40, % h - 25, 0 else MouseMove, % w - 40, % h - 15, 0 @@ -78,14 +97,7 @@ SendInput, {RButton}{Up}{Up}{Up}{Right}c MouseMove, % mx, % my, 0 return -;; -> library - -Counter() -{ - static clicks := 0 - clicks += 1 - return clicks -} +#IfWinActive ahk_group KompoZer ;; -> body @@ -94,11 +106,25 @@ Counter() ; | | a b l e o f c o n t e n t s ; |_| -F5:: ; update table of contents (h2-h6) +ReNumLock: +KeyWait, NumLock +SetNumLockState, On +SetTimer, ReNumLock, Off +return + +; (1) update table of contents (h2-h6) +#If WinActive("ahk_group KompoZer") and !GetKeyState("NumLock", "T") +SC04F:: +if GetKeyState("NumLock", "P") + SetTimer, ReNumLock, On SendInput, !ibu goto toc1 -+F5:: ; create table of contents (h2-h6) +; (1) create table of contents (h2-h6) +#If WinActive("ahk_group KompoZer") and !GetKeyState("NumLock", "T") ++SC04F:: +if GetKeyState("NumLock", "P") + SetTimer, ReNumLock, On SendInput, !ibi goto toc1 @@ -107,11 +133,19 @@ Sleep, 100 SendInput, h2{Tab}{Tab}h3{Tab}{Tab}-{Tab}-{Tab}-{Tab}-{Enter} return -F6:: ; update table of contents (h2 only) +; (2) update table of contents (h2 only) +#If WinActive("ahk_group KompoZer") and !GetKeyState("NumLock", "T") +SC050:: +if GetKeyState("NumLock", "P") + SetTimer, ReNumLock, On SendInput, !ibu goto toc2 -+F6:: ; create table of contents (h2 only) +; (2) create table of contents (h2 only) +#If WinActive("ahk_group KompoZer") and !GetKeyState("NumLock", "T") ++SC050:: +if GetKeyState("NumLock", "P") + SetTimer, ReNumLock, On SendInput, !ibi goto toc2 @@ -120,11 +154,19 @@ Sleep, 100 SendInput, h2 goto toc4 -F7:: ; update table of contents (h3 only) +; (3) update table of contents (h3 only) +#If WinActive("ahk_group KompoZer") and !GetKeyState("NumLock", "T") +SC051:: +if GetKeyState("NumLock", "P") + SetTimer, ReNumLock, On SendInput, !ibu goto toc3 -+F7:: ; create table of contents (h3 only) +; (3) create table of contents (h3 only) +#If WinActive("ahk_group KompoZer") and !GetKeyState("NumLock", "T") ++SC051:: +if GetKeyState("NumLock", "P") + SetTimer, ReNumLock, On SendInput, !ibi goto toc3 -- cgit v1.2.3