Initial commit
This commit is contained in:
commit
d5c932d8e1
710 changed files with 50282 additions and 0 deletions
23
.tmp_axprobe/url.swift
Executable file
23
.tmp_axprobe/url.swift
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
import Cocoa
|
||||
let pid = pid_t(CommandLine.arguments[1])!
|
||||
let app = AXUIElementCreateApplication(pid)
|
||||
var wRef: CFTypeRef?
|
||||
AXUIElementCopyAttributeValue(app, kAXFocusedWindowAttribute as CFString, &wRef)
|
||||
func findWeb(_ e: AXUIElement, _ depth: Int) {
|
||||
if depth > 12 { return }
|
||||
var r: CFTypeRef?
|
||||
AXUIElementCopyAttributeValue(e, kAXRoleAttribute as CFString, &r)
|
||||
if (r as? String) == "AXWebArea" {
|
||||
var u: CFTypeRef?
|
||||
AXUIElementCopyAttributeValue(e, "AXURL" as CFString, &u)
|
||||
var t: CFTypeRef?
|
||||
AXUIElementCopyAttributeValue(e, kAXTitleAttribute as CFString, &t)
|
||||
print("WebArea title=\(String(describing: t)) url=\(String(describing: u))")
|
||||
return
|
||||
}
|
||||
var kids: CFTypeRef?
|
||||
if AXUIElementCopyAttributeValue(e, kAXChildrenAttribute as CFString, &kids) == .success, let arr = kids as? [AXUIElement] {
|
||||
for k in arr { findWeb(k, depth+1) }
|
||||
}
|
||||
}
|
||||
if let w = wRef { findWeb(w as! AXUIElement, 0) }
|
||||
Loading…
Reference in a new issue