diff --git a/lib/HashCalc.ahk2 b/lib/HashCalc.ahk2 index 9328318..6f6ee24 100644 --- a/lib/HashCalc.ahk2 +++ b/lib/HashCalc.ahk2 @@ -1,8 +1,5 @@ -;@Ahk2Exe-SetDescription HashCalc (x64) ;@Ahk2Exe-SetFileVersion 1.0.2 -;@Ahk2Exe-SetProductName HashCalc ;@Ahk2Exe-SetProductVersion 2.0.2 -;@Ahk2Exe-SetCopyright (c) 2014-2023 jNizM ;@Ahk2Exe-SetLanguage 0x0407 diff --git a/lib/hashmanual.ahk2 b/lib/hashmanual.ahk2 index 3aac175..d9c03fb 100644 --- a/lib/hashmanual.ahk2 +++ b/lib/hashmanual.ahk2 @@ -8,4 +8,5 @@ message := "The quick brown fox jumps over the lazy dog" tst := Hash.String("SHA-256", message) MsgBox(tst) +A_Clipboard:=tst diff --git a/publ/ArteKaffee.ahk b/publ/ArteKaffee.ahk new file mode 100644 index 0000000..c178735 --- /dev/null +++ b/publ/ArteKaffee.ahk @@ -0,0 +1,123 @@ +#Requires AutoHotkey v2.0 +#SingleInstance Force +#Include ..\lib\HashCalc.ahk2 +;@Ahk2Exe-ExeName \\artemed.local\Gruppen\FBG\Public\RKK\len_m\#Bail\ArteKaffee.exe +Persistent + +FileInstall("..\akfe-on.ico", A_Temp ".\akfe-on.ico", 1) +FileInstall("..\akfe-off.ico", A_Temp ".\akfe-off.ico", 1) + + +CorrectPassword := "90d1f4d7691b29fe660800537fb82adbc6e7622001c23d97e20f3f1465a668cc" + +result := InputBox( + "Bitte Passwort eingeben:", + "Authentifizierung", + "Password w200 h90" +) + +if (result.Result != "OK") { + ExitApp() +} + +if (Hash.String("SHA-256", result.Value) != CorrectPassword) { + MsgBox("Falsches Passwort!", "Fehler", "Iconx") + ExitApp() +} + + +global IdleTime := 240 ; seconds +global Enabled := true +global LastX := 0 +global LastY := 0 +global LastMoveTime := A_TickCount + +MouseGetPos &LastX, &LastY + + +;========================================================= +; Tray menu +;========================================================= + +A_TrayMenu.Delete() + +A_TrayMenu.Add("Enabled", ToggleEnabled) +A_TrayMenu.Add("Set idle time...", SetIdleTime) +A_TrayMenu.Add() + +A_TrayMenu.Add("Exit", (*) => ExitApp()) +TraySetIcon(A_Temp "\akfe-on.ico") +UpdateTray() + +SetTimer(CheckMouse, 20000) +OnMessage(0x404, TrayIconHandler) + +;========================================================= +; Mouse mover +;========================================================= + +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 + } +} + +TrayIconHandler(wParam, lParam, msg, hwnd) +{ + ; Double left click on tray icon + if (lParam = 0x203) { + ToggleEnabled() + } +} + +;========================================================= +; Tray functions +;========================================================= + +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 { + TraySetIcon(A_Temp "\akfe-on.ico") + A_TrayMenu.Check("Enabled") + A_IconTip := "ArteKaffee - Active" + } else { + TraySetIcon(A_Temp "\akfe-off.ico") + A_TrayMenu.Uncheck("Enabled") + A_IconTip := "ArteKaffee - Disabled" + } +} \ No newline at end of file