mirror of
https://github.com/neon443/DockPhobia.git
synced 2026-03-11 06:49:12 +00:00
applecript funciton
This commit is contained in:
@@ -32,11 +32,15 @@ class MouseTracker {
|
|||||||
fatalError("no screen wtf???")
|
fatalError("no screen wtf???")
|
||||||
}
|
}
|
||||||
addMonitor()
|
addMonitor()
|
||||||
|
applescript("display dialog \"dt\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkMouse(_ event: NSEvent) {
|
func checkMouse(_ event: NSEvent) {
|
||||||
var location = event.locationInWindow
|
var location = event.locationInWindow
|
||||||
|
location.y = screen.height - location.y
|
||||||
|
#if DEBUG
|
||||||
print(location)
|
print(location)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func addMonitor() {
|
func addMonitor() {
|
||||||
@@ -46,6 +50,17 @@ class MouseTracker {
|
|||||||
func removeMonitor() {
|
func removeMonitor() {
|
||||||
NSEvent.removeMonitor(monitor as Any)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user