From 5e0537cb20cf45fb8c2e16ba829f93636ba94de2 Mon Sep 17 00:00:00 2001 From: Steve Jordi Date: Tue, 29 Sep 2026 16:35:18 +0200 Subject: [PATCH] Mouse Click (1.1) to trigger action against sleep Mouse movements seem to not be enough to appear active. --- main.pas | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/main.pas b/main.pas index f9cc56e..36f8315 100644 --- a/main.pas +++ b/main.pas @@ -17,8 +17,11 @@ type private { Private declarations } FMyTask : ITask ; + currentPos : TPoint ; + counter : Integer ; procedure startTask ; - procedure stopTask ; + procedure stopTask ; + public { Public declarations } end; @@ -37,8 +40,10 @@ implementation procedure TfrmMain.FormCreate(Sender: TObject); begin - direction := False ; - runIt := False ; + direction := False ; + runIt := False ; + currentPos := Point( mouse.CursorPos.X , mouse.CursorPos.Y ) ; + counter := 0 ; end; @@ -82,6 +87,21 @@ begin procedure begin direction := Not direction ; + counter := counter + 1 ; + if counter >= 60 then + begin + counter := 0 ; + // Move cursor to specific screen coordinates + currentPos := Point( mouse.CursorPos.X , mouse.CursorPos.Y ) ; + mouse.CursorPos := Point( 1, 1 ) ; + // Simulate mouse button press and release + mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 1, 1, 0); + Sleep(150); + mouse_event(MOUSEEVENTF_LEFTUP, 0, 1, 1, 0); + // Get back to position + mouse.CursorPos := currentPos ; + end; + if direction then mouse.CursorPos := Point( mouse.CursorPos.X + 2, mouse.CursorPos.Y + 2 ) else