Initial commit
This commit is contained in:
commit
d5c932d8e1
710 changed files with 50282 additions and 0 deletions
18
.tmp_axprobe/hovercheck.swift
Executable file
18
.tmp_axprobe/hovercheck.swift
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
import Cocoa
|
||||
func moveMouse(_ x: CGFloat, _ y: CGFloat) {
|
||||
let ev = CGEvent(mouseEventSource: nil, mouseType: .mouseMoved, mouseCursorPosition: CGPoint(x: x, y: y), mouseButton: .left)
|
||||
ev?.post(tap: .cghidEventTap)
|
||||
}
|
||||
func capture(_ name: String) {
|
||||
let rect = CGRect(x: 349, y: 159, width: 1161, height: 1102)
|
||||
guard let img = CGWindowListCreateImage(rect, .optionOnScreenOnly, kCGNullWindowID, [.boundsIgnoreFraming, .nominalResolution]) else { print("capture fail"); return }
|
||||
let url = URL(fileURLWithPath: name)
|
||||
guard let dest = CGImageDestinationCreateWithURL(url as CFURL, "public.png" as CFString, 1, nil) else { return }
|
||||
CGImageDestinationAddImage(dest, img, nil)
|
||||
CGImageDestinationFinalize(dest)
|
||||
print("captured \(name) \(img.width)x\(img.height)")
|
||||
}
|
||||
moveMouse(1900, 1350); usleep(600_000)
|
||||
capture("away.png")
|
||||
moveMouse(849, 707); usleep(700_000)
|
||||
capture("over.png")
|
||||
Loading…
Reference in a new issue