From b79a7d5de7f9ffd94c2289a263fb3d16b22c79d0 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Fri, 23 May 2025 14:27:52 +0100 Subject: [PATCH] applecript funciton --- DockPhobia/MouseTracker.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/DockPhobia/MouseTracker.swift b/DockPhobia/MouseTracker.swift index f84d350..8952648 100644 --- a/DockPhobia/MouseTracker.swift +++ b/DockPhobia/MouseTracker.swift @@ -32,11 +32,15 @@ class MouseTracker { fatalError("no screen wtf???") } addMonitor() + applescript("display dialog \"dt\"") } func checkMouse(_ event: NSEvent) { var location = event.locationInWindow + location.y = screen.height - location.y + #if DEBUG print(location) + #endif } func addMonitor() { @@ -46,6 +50,17 @@ class MouseTracker { func removeMonitor() { NSEvent.removeMonitor(monitor as Any) } + + func applescript(_ script: String) { + var error: NSDictionary? + if let scriptObject = NSAppleScript(source: script) { + let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(&error) + print(output) + if (error != nil) { + print(error as Any) + } + } + } }