aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-08-24 23:27:32 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-08-24 23:27:32 +0200
commitf877ecf77c05f5f849bdfa495b104e09ef58562c (patch)
tree092b41631109b11610c9b243eee274df531b86a3
parent2a5d03cf7be4cb76ae10e0a20a17e2f3ad5780ee (diff)
downloadahk-f877ecf77c05f5f849bdfa495b104e09ef58562c.tar.gz
programs: Add Victoria 2 hotkeys and cursor clipping
-rw-r--r--tt.programs.ahk45
1 files changed, 45 insertions, 0 deletions
diff --git a/tt.programs.ahk b/tt.programs.ahk
index ee1df2f..0459825 100644
--- a/tt.programs.ahk
+++ b/tt.programs.ahk
@@ -164,4 +164,49 @@ return
!d::SendInput, {LCtrl Down}l{LCtrl Up}
+/*
+#IfWinActive ahk_class Notepad2
+
+F5::
+
+return
+*/
+
+#If WinActive("ahk_exe v2game.exe")
+
+MButton::RButton
+RButton::MButton
+
+;; -> library
+
+ClipCursor(Confines := True, Left := 100, Top := 200, Right := 800, Bottom := 900)
+{
+ if !(Confines)
+ return DllCall("user32.dll\ClipCursor")
+ static RECT, init := VarSetCapacity(RECT, 16, 0)
+ NumPut(Left, RECT, 0, "Int"), NumPut(Top, RECT, 4, "Int"), NumPut(Right, RECT, 8, "Int"), NumPut(Bottom, RECT, 12, "Int")
+ if !(DllCall("user32.dll\ClipCursor", "Ptr", &RECT))
+ return DllCall("kernel32.dll\GetLastError")
+ return 1
+}
+
+VictoriaWindowMessage(wParam, lParam)
+{
+ if (wParam = 4 or wParam = 32772) ; HSHELL_WINDOW_ACTIVATED | HSHELL_RUDEAPPACTIVATED
+ {
+ WinGet, exe, ProcessName, A
+ if (exe = "v2game.exe")
+ {
+ Sleep, 1500
+ ClipCursor(True, 6, 6, A_ScreenWidth-5, A_ScreenHeight-5)
+ }
+ }
+}
+
+;; -> init
+
+WindowMessageHandlers.Push("VictoriaWindowMessage")
+
+;; -> body
+
#IfWinActive