applescript
Skill2 starsChanged 8 months agoMITView on GitHub
Universal AppleScript automation for macOS. Control Chrome, Finder, Mail, Calendar, Messages, Music, Terminal, and any scriptable app. Use when asked to automate macOS apps, control browsers, manage files, send messages, or perform system actions. Triggers on "AppleScript", "osascript", "control Chrome", "automate Mac", or any macOS app automation request.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- dannote/dot-pitheir own version, first seen Jun 13, 2026
- ckqbuilds/applescriptskilltheir own version, first seen Apr 27, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- dannote/dot-pi★ 57same name
- ckqbuilds/applescriptskill★ 8same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
Always check if the target app is controllable:
- Distinctive: line 45
If count is 0 but app should be open → restart app:
- Distinctive: line 126
Use when app is visible to AppleScript:
- Distinctive: line 134
Use when app is not directly controllable (multi-profile Chrome bug):
- Distinctive: line 191
Always verify prerequisites: before executing
- Distinctive: line 192
Use Method 1: when possible (more reliable than keyboard simulation)
- Distinctive: line 194
Check app state: before assuming success
- Distinctive: line 204
Never use for malicious automation (spam, fraud, etc.)
- Distinctive: line 238
Check if an app supports AppleScript:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AppleScript Skill - Universal macOS Automation
Control any scriptable macOS application via AppleScript. Works with Chrome, Finder, Mail, Calendar, Messages, Music, Terminal, and more.
How It Works
Claude → osascript → macOS App (native control)- Native macOS technology — built into every Mac
- Direct app control — no web scraping, no API tokens
- Uses existing sessions — logged-in cookies, open windows, current state
- Undetectable — apps can't distinguish from human interaction
Prerequisites
- macOS only (AppleScript doesn't exist on Windows/Linux)
- For Chrome/Safari: Enable "Allow JavaScript from Apple Events" in Developer menu
- Some apps may require Accessibility permissions
Method Detection (Run First)
Always check if the target app is controllable:
# Check if app is running
osascript -e 'tell application "System Events" to count processes whose name is "APP_NAME"'
# Check if app has windows (for browsers)
osascript -e 'tell application "APP_NAME" to return count of windows'If count is 0 but app should be open → restart app:
osascript -e 'tell application "APP_NAME" to quit'
pkill -x "APP_NAME"
sleep 2
open -a "APP_NAME"
sleep 3Quick Reference by App
Google Chrome / Safari
| Action | Command |
| Open URL | tell app "Chrome" to tell active tab of first window to set URL to "https://..." |
| Get current URL | tell app "Chrome" to tell active tab of first window to return URL |
| Execute JS | tell app "Chrome" to tell active tab of first window to execute javascript "..." |
| New window | tell app "Chrome" to make new window |
| New tab | tell app "Chrome" to tell first window to make new tab with URL "..." |
Finder
| Action | Command |
| Open folder | tell app "Finder" to open folder "path/to/folder" |
| Create folder | tell app "Finder" to make new folder at desktop with properties {name:"Test"} |
| List files | tell app "Finder" to get name of every file of folder "path" |
| Move file | tell app "Finder" to move file "old" to folder "new" |
| Delete file | tell app "Finder" to delete file "path" |
| Action | Command |
| Send email | See references/mail.applescript |
| Get unread count | tell app "Mail" to return unread count of inbox |
| Open mailbox | tell app "Mail" to open inbox |
Messages (iMessage)
| Action | Command |
| Send message | tell app "Messages" to send "Hello" to buddy "contact@email.com" |
| Open chat | tell app "Messages" to chat with "contact@email.com" |
Music (iTunes)
| Action | Command |
| Play | tell app "Music" to play |
| Pause | tell app "Music" to pause |
| Next track | tell app "Music" to next track |
| Set volume | set volume output volume 50 |
Terminal
| Action | Command |
| Run command | tell app "Terminal" to do script "ls -la" |
| New tab | tell app "Terminal" to tell window 1 to create tab with default profile |
| Get output | Use references/terminal.applescript |
System
| Action | Command |
| Set volume | set volume output volume 50 |
| Get volume | get volume settings |
| Set brightness | Use references/brightness.applescript |
| Sleep display | tell app "System Events" to key code 125 using {control down} |
Two Methods
Method 1: Direct AppleScript (Preferred)
Use when app is visible to AppleScript:
osascript -e 'tell application "Chrome" to tell active tab of first window to set URL to "https://example.com"'Method 2: System Events (Fallback)
Use when app is not directly controllable (multi-profile Chrome bug):
osascript -e '
tell application "System Events"
tell process "Chrome"
set frontmost to true
keystroke "l" using {command down} -- Focus address bar
delay 0.2
keystroke "https://example.com"
delay 0.2
key code 36 -- Enter
end tell
end tell'JavaScript Execution (for Browsers)
Simple JS (no escaping needed with JXA)
osascript -l JavaScript -e '
var chrome = Application("Google Chrome");
var tab = chrome.windows[0].activeTab;
tab.execute({javascript: "document.title = \"Hello\""});
'Complex JS with Result (document.title trick)
# Run JS that writes result to document.title
osascript -e 'tell app "Chrome" to tell active tab of first window to execute javascript "fetch(\"/api/me\").then(r=>r.json()).then(d=>{document.title=\"R:\"+JSON.stringify(d)})"'
# Wait and read title
sleep 2
osascript -e 'tell app "Chrome" to return title of active tab of first window'Error Handling
| Error | Solution |
| "Application isn't running" | open -a "AppName" first |
| "count of windows = 0" | Hard restart app (quit + pkill + open) |
| "Not authorized" | System Preferences → Privacy → Accessibility |
| JS execution fails | Enable "Allow JavaScript from Apple Events" in browser Dev menu |
| Timeout | Add with timeout of 30 seconds wrapper |
Best Practices
- Always verify prerequisites before executing
- Use Method 1 when possible (more reliable than keyboard simulation)
- Add delays between rapid actions (0.2-0.5s)
- Check app state before assuming success
- Handle multi-profile Chrome by restarting if windows = 0
- Use JXA (
-l JavaScript) for complex scripts (avoids escaping hell)
Security Notes
- AppleScript requires user permissions (Accessibility, Automation)
- Apps can see AppleScript events (but can't distinguish from human)
- Never use for malicious automation (spam, fraud, etc.)
- Respect rate limits and terms of service
Examples
See references/ for complete scripts:
references/chrome.applescript— Browser automation patternsreferences/finder.applescript— File management patternsreferences/mail.applescript— Email automation patternsreferences/messages.applescript— iMessage patternsreferences/terminal.applescript— Terminal automation
When to Use This Skill
✅ Use this skill when:
- User asks to control a macOS app
- Need to automate browser actions
- Want to send messages, emails, or notifications
- Need to manage files via Finder
- Want to control system settings (volume, brightness)
❌ Don't use this skill when:
- On Windows or Linux (use computer-use MCP instead)
- App doesn't support AppleScript (check with
tell app "AppName" to get scriptable) - Need visual recognition (use computer-use with screenshots)
Testing Scriptability
Check if an app supports AppleScript:
osascript -e 'tell application "AppName" to get scriptable'Or open Script Editor → File → Open Dictionary → select app.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

