Files

121 lines
2.7 KiB
Plaintext
Raw Permalink Normal View History

2026-07-23 15:09:02 +02:00
#Requires AutoHotkey v2.0
#SingleInstance Force
Persistent
2026-07-29 10:46:04 +02:00
FileInstall("akfe-on.ico", A_Temp "\akfe-on.ico", 1)
FileInstall("akfe-off.ico", A_Temp "\akfe-off.ico", 1)
2026-07-23 15:09:02 +02:00
global IdleTime := 240 ; seconds
global Enabled := true
global LastX := 0
global LastY := 0
global LastMoveTime := A_TickCount
MouseGetPos &LastX, &LastY
2026-07-27 11:17:59 +02:00
;=========================================================
; Tray menu
;=========================================================
2026-07-23 15:09:02 +02:00
A_TrayMenu.Delete()
A_TrayMenu.Add("Enabled", ToggleEnabled)
A_TrayMenu.Add("Set idle time...", SetIdleTime)
2026-07-27 11:17:59 +02:00
A_TrayMenu.Add()
; Copypasta submenu
CopyMenu := Menu()
CopyMenu.Add("Standardpasswort", SetClipboard.Bind("BitteÄndern!"))
CopyMenu.Add("Password Ticket", SetClipboard.Bind("Auf Standardpasswort zurückgesetzt."))
CopyMenu.Add("Berechtigt", SetClipboard.Bind("Berechtigung erteilt."))
CopyMenu.Add("Erledigt", SetClipboard.Bind("Erledigt."))
A_TrayMenu.Add("Noodle", CopyMenu)
2026-07-23 15:09:02 +02:00
A_TrayMenu.Add()
A_TrayMenu.Add("Exit", (*) => ExitApp())
2026-07-27 12:32:11 +02:00
TraySetIcon(A_Temp "\akfe-on.ico")
2026-07-23 15:09:02 +02:00
UpdateTray()
SetTimer(CheckMouse, 20000)
2026-07-27 12:32:11 +02:00
OnMessage(0x404, TrayIconHandler)
2026-07-27 11:17:59 +02:00
;=========================================================
; Mouse mover
;=========================================================
2026-07-23 15:09:02 +02:00
CheckMouse() {
global Enabled, IdleTime, LastX, LastY, LastMoveTime
if !Enabled
return
MouseGetPos &x, &y
if (x != LastX || y != LastY) {
LastX := x
LastY := y
LastMoveTime := A_TickCount
return
}
if (A_TickCount - LastMoveTime >= IdleTime * 1000) {
MouseMove x + 1, y, 0
MouseMove x, y, 0
LastMoveTime := A_TickCount
}
}
2026-07-27 12:32:11 +02:00
TrayIconHandler(wParam, lParam, msg, hwnd)
{
; Double left click on tray icon
if (lParam = 0x203) {
ToggleEnabled()
}
}
2026-07-27 11:17:59 +02:00
;=========================================================
; Tray functions
;=========================================================
2026-07-23 15:09:02 +02:00
ToggleEnabled(*) {
global Enabled
Enabled := !Enabled
UpdateTray()
}
SetIdleTime(*) {
global IdleTime
result := InputBox("Enter idle time in seconds:", "Mouse mover settings", "w200 h90", IdleTime)
if result.Result = "OK" && IsNumber(result.Value) {
IdleTime := Integer(result.Value)
}
}
UpdateTray() {
global Enabled
if Enabled {
2026-07-27 12:32:11 +02:00
TraySetIcon(A_Temp "\akfe-on.ico")
2026-07-23 15:09:02 +02:00
A_TrayMenu.Check("Enabled")
2026-07-27 12:32:11 +02:00
A_IconTip := "ArteKaffee - Active"
2026-07-23 15:09:02 +02:00
} else {
2026-07-27 12:32:11 +02:00
TraySetIcon(A_Temp "\akfe-off.ico")
2026-07-23 15:09:02 +02:00
A_TrayMenu.Uncheck("Enabled")
2026-07-27 12:32:11 +02:00
A_IconTip := "ArteKaffee - Disabled"
2026-07-23 15:09:02 +02:00
}
}
2026-07-27 11:17:59 +02:00
;=========================================================
; Clipboard
;=========================================================
SetClipboard(txt, *) {
A_Clipboard := txt
}