Initial commit
This commit is contained in:
commit
d5c932d8e1
710 changed files with 50282 additions and 0 deletions
14
.tmp_axprobe/zyset.swift
Normal file
14
.tmp_axprobe/zyset.swift
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import Cocoa
|
||||
let pid = pid_t(CommandLine.arguments[1])!
|
||||
let app = AXUIElementCreateApplication(pid)
|
||||
var focused: CFTypeRef?
|
||||
AXUIElementCopyAttributeValue(app, kAXFocusedUIElementAttribute as CFString, &focused)
|
||||
if let f = focused {
|
||||
var r1: CFTypeRef?
|
||||
AXUIElementCopyAttributeValue(f as! AXUIElement, kAXRoleAttribute as CFString, &r1)
|
||||
print("focused role: \(r1 as? String ?? "?")")
|
||||
let setR = AXUIElementSetAttributeValue(f as! AXUIElement, kAXValueAttribute as CFString, "ZYSET-PROBE" as CFTypeRef)
|
||||
print("set value result: \(setR.rawValue) (0=success)")
|
||||
// 立即清空,不留痕
|
||||
AXUIElementSetAttributeValue(f as! AXUIElement, kAXValueAttribute as CFString, "" as CFTypeRef)
|
||||
} else { print("no focused element") }
|
||||
Loading…
Reference in a new issue