xiaohongshu
xiaohongshu
automating-mac-apps
Automates macOS apps via Apple Events using AppleScript (discovery), JXA (legacy), and PyXA (modern Python). Use when asked to "automate Mac apps", "write AppleScript", "JXA scripting", "osascript automation", or "PyXA Python automation". Foundation skill for all macOS app automation.
Full skill instructions
JXA and AppleScript are legacy (last major updates: 2015-2016). Modern alternatives:
Test scripts on target macOS due to:
tell application "Finder" to get name of first item in desktoptry { ... } catch (e) { console.log('Error:', e.message); }try ... on error errMsg ... end tryosascript -e 'tell application "Finder" to get name of home'osascript for CLI or pipeline use.tell application "System Events" to click button 1 of window 1 of process "App"Application('System Events').processes.byName('App').windows[0].buttons[0].click()Application("App").running() returns trueskills/automating-mac-apps/scripts/request_automation_permissions.sh (or .py).skills/automating-<app>/scripts/set_up_<app>_automation.{sh,py} (calendar, notes, mail, keynote, excel, reminders).skills/automating-voice-memos/scripts/set_up_voice_memos_automation.sh to activate app + check data paths; enable Accessibility + consider Full Disk Access.PyXA (Python for macOS Automation) - Preferred for new projects:
app.lists().reminders().title()# Install PyXA
pip install mac-pyxa
# Or with pip3 explicitly
pip3 install mac-pyxa
# Requirements:
# - Python 3.10+ (check with: python3 --version)
# - macOS 12+ (Monterey or later recommended)
# - PyObjC is installed automatically as a dependency
# Verify installation
python3 -c "import PyXA; print(f'PyXA {PyXA.__version__} installed successfully')"
Note: All app-specific skills in this plugin that show PyXA examples assume PyXA is installed. See this section for installation.
import PyXA
# Launch Safari and navigate
safari = PyXA.Safari()
safari.activate()
safari.open_location("https://example.com")
# Get current tab URL
current_url = safari.current_tab.url
print(f"Current URL: {current_url}")
import PyXA
reminders = PyXA.Reminders()
work_list = reminders.lists().by_name("Work")
# Add new reminder
new_reminder = work_list.reminders().push({
"name": "Review PyXA documentation",
"body": "Explore modern macOS automation options"
})
PyXA Official Resources:
PyObjC (Python-Objective-C Bridge) - For Low-Level macOS Integration:
pip install pyobjc
# Installs bridges for major frameworks
from Foundation import NSAppleScript
# Execute AppleScript from Python
script_source = '''
tell application "Safari"
return URL of current tab
end tell
'''
script = NSAppleScript.alloc().initWithSource_(script_source)
result, error = script.executeAndReturnError_(None)
if error:
print(f"Error: {error}")
else:
print(f"Current Safari URL: {result.stringValue()}")
from ScriptingBridge import SBApplication
# Control Mail app
mail = SBApplication.applicationWithBundleIdentifier_("com.apple.Mail")
inbox = mail.inboxes()[0] # Access first inbox
# Get unread message count
unread_count = inbox.unreadCount()
print(f"Unread messages: {unread_count}")
PyObjC Official Resources:
JXA has no updates since 2016. Use PyXA for new projects when possible.
automating-[app] skills as needed)ci-cd-tcc for advanced permission management in automated environmentsmastering-applescript for AppleScript-focused workflowsPermission Management:
Official Apple Security Guidance:
JSON.stringify(result) in JXA.
console.log(JSON.stringify({files: files, count: files.length}))osascript exits with 0 for success, non-zero for failure.automating-mac-apps/references/basics.mdautomating-mac-apps/references/applescript-basics.mdautomating-mac-apps/references/recipes.mdautomating-mac-apps/references/cookbook.mdautomating-mac-apps/references/applescript-performance.mdautomating-mac-apps/references/ci-cd-tcc.mdautomating-mac-apps/references/shell-environment.mdautomating-mac-apps/references/ui-scripting-inspector.mdautomating-mac-apps/references/pyxa-core-api-reference.mdautomating-mac-apps/references/pyxa-basics.md (Modern Python automation fundamentals)automating-mac-apps/references/applescript-to-pyxa-conversion.md (Migration guide with examples)automating-mac-apps/references/translation-checklist.md (Comprehensive guide with examples and pitfalls)automating-mac-apps/references/helpers.jswhose Batching Patterns: automating-mac-apps/references/whos-batching.mdautomating-mac-apps/references/dictionary-strategies.mdautomating-mac-apps/references/applescript-asobjc.mdRelated Skills:
web-browser-automation: Complete browser automation guide (Chrome, Edge, Brave, Arc)xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience