Beyond the Browser

AI Agent Automation with AppleScript + Copilot

Why browser automation (Playwright) is just the tip of the iceberg — and how OS-level control unlocks truly autonomous AI agents.

Playwright
+
AppleScript
+
Copilot API
=
Full OS Agent

The Limitation of Browser-Only Agents

Playwright and Selenium can only see the DOM. They're blind to the rest of the computer.

PLAYWRIGHT

Browser sandbox only

  • Cannot read/send iMessages or emails
  • Cannot control system volume or audio
  • Cannot interact with native apps
  • Cannot take OS-level screenshots
  • Cannot manage calendar or reminders
  • Cannot toggle WiFi, Bluetooth, DND
  • Cannot open/close/move windows
  • Cannot run keyboard shortcuts
VS
APPLESCRIPT

Full OS control

  • Send iMessages to any contact
  • Control volume, play music
  • Open/control any macOS app
  • Screenshot any region of screen
  • Create calendar events & reminders
  • Toggle WiFi, Bluetooth, DND
  • Move, resize, arrange windows
  • Simulate any keystroke or click

31 AppleScript Tools — Built in One Day

Each tool is a standalone bash script. Zero dependencies. Works on any Mac.

as-alert
Multi-channel alerts
as-bluetooth
BT on/off/devices
as-calendar
Events & schedules
as-chatgpt
ChatGPT via Chrome
as-clipboard
Copy/paste control
as-contacts
Address book access
as-copilot
M365 Copilot chat
as-cron
Scheduled tasks
as-darkmode
Theme toggle
as-dnd
Do Not Disturb
as-finder
File management
as-focus-mode
Focus profiles
as-keypress
Simulate input
as-mail
Read/send email
as-messages
iMessage send/read
as-morning
Morning routine
as-music
Apple Music ctrl
as-notes
Apple Notes
as-ocr
Screen text extract
as-pdf
PDF generation
as-reminders
Reminders app
as-safari
Safari control
as-screen
Screen capture
as-screenshot
Region capture
as-shortcuts
Siri Shortcuts
as-system
System prefs
as-tabs
Browser tab mgmt
as-terminal
Terminal commands
as-translate
Language tools
as-volume
Audio control
as-weather
Weather data

Architecture: Agent + AppleScript + Copilot

The agent runs a continuous loop, using AppleScript as its hands and Copilot as its brain extension.

Message Queue
→
AI Agent (Loop)
→
Decide Action
AppleScript
←
Execute Tool
→
OS / Apps / Web
# Agent receives: "Check my calendar and text me a summary"

# Step 1: Read calendar (AppleScript)
bash tools/as-calendar.sh today
# Returns: 3 meetings, 1 lunch, standup at 9am

# Step 2: Summarize with Copilot (no API key needed!)
bash tools/as-copilot.sh "Summarize these meetings..."
# Returns: formatted summary

# Step 3: Send via iMessage (AppleScript)
bash tools/as-messages.sh send "+1555..." "Your day: ..."

Demo: Morning Autopilot

Agent wakes up and prepares your morning without you touching a thing.

1
as-weather.sh — Fetch today's weather forecast
2
as-calendar.sh today — Pull today's meetings and events
3
rss.sh cnbc 3 — Scan top market headlines
4
as-copilot.sh — "Write a brief morning briefing combining weather, schedule, and market news"
5
as-say.sh — Read the briefing aloud through speakers
6
as-music.sh play — Start your morning playlist
7
as-messages.sh — Text the briefing to your phone

Playwright cannot do ANY of steps 1-2, 5-7.

Demo: Market Alert Pipeline

Agent monitors markets and escalates alerts across channels.

1
stock-quote.sh SPY — Agent polls S&P 500 every 5 minutes
2
Detects >1% drop → as-copilot.sh "Analyze why SPY is dropping, check VIX, sector rotation"
3
as-screenshot.sh — Capture the trading chart from browser
4
as-alert.sh --critical — Desktop notification + spoken alert + sound
5
as-messages.sh — Send iMessage: "SPY -1.3% — VIX spike, tech leading sell-off"
6
as-mail.sh — Email detailed analysis to team distribution list

Multi-sensory alert: visual + audio + text + email — all automated.

Copilot: Zero-Cost LLM via AppleScript

as-copilot.sh uses Chrome + AppleScript + JS Apple Events to chat with M365 Copilot — no API key needed.

# How it works (simplified):
# 1. Find or open Chrome tab at copilot.microsoft.com
osascript -e 'tell application "Chrome" to open location "copilot.microsoft.com"'

# 2. Inject prompt via JavaScript Apple Events
osascript -e 'tell application "Chrome" to execute active tab of window 1 javascript " document.querySelector(\"textarea\").value = prompt; document.querySelector(\"[data-testid=send]\").click(); "'

# 3. Wait for response, extract text
osascript -e 'tell application "Chrome" to execute ... javascript " document.querySelector(\".response-content\").innerText "'

# Works with ChatGPT, Perplexity, Grok — same pattern

No API key

Uses your existing browser login session

No rate limits

Human-speed interaction, no API throttling

Multi-provider

Same technique works for ChatGPT, Grok, Perplexity

Visual Intelligence: Screen Monitoring

as-screen-monitor.sh watches any region of the screen for visual changes — dashboards, charts, build pipelines.

📊

Dashboard Watch

Monitor Grafana/Datadog dashboards for visual anomalies. Screenshot, diff, alert on change.

📈

Chart Monitoring

Watch trading charts for pattern breaks. Take periodic screenshots and compare pixel differences.

🔧

Build Pipelines

Watch CI/CD status pages. Detect red builds instantly, alert the team via iMessage + email.

🖥️

OCR + Analysis

as-ocr.sh extracts text from any screen region. Feed to LLM for analysis — no API integration needed.

This is impossible with Playwright — it can only see its own browser context, not other apps.

Why This Matters for Enterprise

Zero Dependencies

Pure bash + AppleScript. No npm install, no Python packages, no Docker. Works on any Mac out of the box.

Security Model

AppleScript runs under the user's macOS permissions. No elevated access. Uses existing SSO sessions.

Cost Efficiency

as-copilot.sh uses your existing M365 license. No additional API costs. Unlimited queries through the browser.

Composable Tools

Each tool is a standalone script. Chain them together for complex workflows. Easy to audit, extend, or replace.

Cross-App Integration

Calendar + Email + Messages + Finder + Safari + Terminal — all accessible from one agent loop.

Persistent Agent

Runs 24/7 in a loop. Polls for work, thinks, acts, rests. Survives crashes via state persistence.

Playwright + AppleScript + Copilot

The complete automation stack for macOS AI agents
Web Automation
Playwright
+
OS Control
AppleScript
+
AI Brain
Copilot / LLM
+
Agent Loop
Orconectes
31+

AppleScript tools built

0

External dependencies

$0

Additional API costs

Built on Orconectes Framework — orconectes.com

1 / 10