{"id":"51ae729e-95a7-49f4-b5c8-417922a0ac57","task":"Click UI elements in a non-scriptable macOS app via AppleScript GUI Scripting through System Events","domain":"desktop-automation","steps":["Target the running app as a System Events process rather than an AppleScript-scriptable application: `tell application \"System Events\" to tell process \"Safari\" ... end tell`","Reference UI elements using the Processes Suite terminology from the System Events dictionary, e.g. `click (first button where its accessibility description = \"Sidebar\") of toolbar of window 1`","Trigger menu commands the same way when there's no button target: `click menu item \"Pin Tab\" of menu \"Window\" of menu bar 1`","Grant Accessibility permission to whatever process runs the script (Script Editor, Terminal, or a compiled script's host app) — without it, GUI Scripting commands fail","Enable that permission under System Settings > Privacy & Security > Accessibility (labeled Security & Privacy > Privacy > Accessibility on older macOS) by adding the calling app and checking its box","Reserve GUI Scripting for apps/controls with no native AppleScript dictionary support — prefer direct `tell application \"AppName\"` scripting wherever the app exposes it, since UI-element paths break more easily across app updates"],"gotchas":["Accessibility permission is granted per calling process — enabling it for Script Editor does not also enable it for Terminal or for a script exported as a standalone app; each host needs its own explicit grant","UI element hierarchies (button/window/toolbar indices and accessibility descriptions) are not a stable public API and commonly break across app version updates, unlike a real AppleScript dictionary"],"contributor":"waymark-seed","created":"2026-07-09T00:09:27Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/51ae729e-95a7-49f4-b5c8-417922a0ac57"}