mac-automation
AppleScriptを使ってMacのメール、リマインダー、Safari、Finder操作、音量調整、アプリ起動など、様々な自動化要求に対応し、開発ツールやメディアプレイヤー等の操作も可能にするSkill。
📜 元の英語説明(参考)
This skill should be used when the user requests Mac automation via AppleScript, including: Mail operations, Reminders/Calendar management, Safari control, Finder operations, system controls (volume, brightness, notifications, app launching), third-party apps (development tools, task management, media players), or mentions "AppleScript" or "automate Mac".
🇯🇵 日本人クリエイター向け解説
AppleScriptを使ってMacのメール、リマインダー、Safari、Finder操作、音量調整、アプリ起動など、様々な自動化要求に対応し、開発ツールやメディアプレイヤー等の操作も可能にするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o mac-automation.zip https://jpskill.com/download/16768.zip && unzip -o mac-automation.zip && rm mac-automation.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16768.zip -OutFile "$d\mac-automation.zip"; Expand-Archive "$d\mac-automation.zip" -DestinationPath $d -Force; ri "$d\mac-automation.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
mac-automation.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
mac-automationフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 7
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
AppleScript による Mac の自動化
このスキルは、osascript コマンド経由で AppleScript を実行することにより、macOS アプリケーションとシステム機能を制御できるようにします。
基本原則
osascript を使用して Bash ツールで AppleScript コマンドを実行します。
osascript -e 'ここに AppleScript コード'
複数行のスクリプトの場合:
osascript <<'EOF'
tell application "App Name"
-- コマンドをここに
end tell
EOF
サポートされているアプリケーションと機能
1. Mail (邮件)
- 件名、本文、宛先を指定してメールを送信
- 未読メールを読む
- メールを検索
- 下書きを作成
2. Reminders (提醒事项)
- 期日付きのリマインダーを作成
- リストごとにリマインダーを一覧表示
- リマインダーを完了/削除
- リマインダーリストを作成
3. Calendar (日历)
- 時間、場所、メモを指定してイベントを作成
- 今日/今後のイベントを一覧表示
- イベントを削除
- カレンダーを作成
4. Notification Center (通知中心)
- システム通知を表示
- カスタムタイトル、サブタイトル、メッセージ
- サウンドアラート
5. Safari
- URL を開く
- 現在のページ情報を取得
- JavaScript を実行
- タブとウィンドウを管理
6. Finder
- フォルダを開く
- ファイル情報を取得/設定
- ファイルを移動、コピー、削除
- フォルダを作成
- ファイルを表示
7. System Controls (系统控制)
- 音量コントロール (ミュート、レベル設定)
- 明るさ (外部ツール経由)
- アプリケーションを開く
- システム情報クエリ
- スリープ/再起動/シャットダウン (慎重に)
8. Third-Party Applications
多くのサードパーティ製アプリが AppleScript をサポートしています。一般的なカテゴリには、開発ツール (iTerm2, VS Code)、タスク管理 (OmniFocus, Things)、メディアプレーヤー (Spotify)、ブラウザ (Chrome)、およびコミュニケーションツールが含まれます。アプリが AppleScript をサポートしているかどうかを確認するには、スクリプトエディタを開いてその辞書を参照するか、tell application "AppName" to get name のような基本的なコマンドを試してください。
実行ガイドライン
セキュリティに関する考慮事項
-
許可プロンプト: 特定のアプリを初めて使用すると、macOS の許可ダイアログがトリガーされます。許可が原因で自動化が失敗した場合は、ユーザーに通知してください。
-
機密性の高い操作: 破壊的な操作 (削除、シャットダウン) の場合は、実行する前にユーザーに確認してください。
-
プライバシーに関わるデータ: メールやカレンダーのイベントを読むときは、ユーザーが明示的に要求したもののみを表示してください。
エラー処理
一般的なエラーと解決策:
"Application not found"→ アプリ名のスペルを確認"Not authorized"→ 「システム環境設定」>「プライバシーとセキュリティ」にユーザーを誘導"Can't get..."→ リソースが存在しないため、適切に処理
ベストプラクティス
- 正確なアプリ名を使用: "Mail"、"Reminders"、"Calendar"、"Safari"、"Finder"
- 特殊文字をエスケープ: 文字列内の引用符には
\"を使用 - Unicode を処理: AppleScript は中国語/Unicode をネイティブに処理
- アプリの状態を確認: 一部の操作では、アプリが実行されている必要があります
クイックリファレンス
通知
osascript -e 'display notification "消息内容" with title "标题"'
アプリケーションを開く
osascript -e 'tell application "AppName" to activate'
音量コントロール
# 音量を取得
osascript -e 'output volume of (get volume settings)'
# 音量を設定 (0-100)
osascript -e 'set volume output volume 50'
# ミュート
osascript -e 'set volume output muted true'
システムコマンド
# クリップボードを取得
osascript -e 'the clipboard'
# クリップボードを設定
osascript -e 'set the clipboard to "text"'
追加リソース
参照ファイル
アプリケーションごとの詳細な AppleScript パターンについては、以下を参照してください。
references/mail-applescript.md- メール操作: 送信、読み取り、検索、下書きreferences/reminders-applescript.md- リマインダー操作: 作成、リスト、完了references/calendar-applescript.md- カレンダー操作: イベント、カレンダーreferences/safari-applescript.md- Safari 操作: URL、タブ、JavaScriptreferences/finder-applescript.md- Finder 操作: ファイル、フォルダreferences/system-applescript.md- システムコントロール: 音量、アプリ、クリップボード
サンプルファイル
examples/ にある動作例:
daily-briefing.applescript- 今日のカレンダーと未読メールを取得quick-note.applescript- クリップボードからリマインダーを作成
ユーティリティスクリプト
scripts/ 内のスクリプト:
run-applescript.sh- 安全な AppleScript 実行のためのラッパー
ワークフローパターン
パターン 1: 情報取得
- AppleScript を実行してデータをクエリ
- 出力を解析
- フォーマットされた結果をユーザーに提示
パターン 2: アクション実行
- 破壊的な場合は、ユーザーにアクションを確認
- AppleScript を実行
- 成功を確認
- 結果を報告
パターン 3: 複数アプリの自動化
- 複数の AppleScript 呼び出しをチェーン
- シェル変数を使用して呼び出し間でデータを渡す
- 各ステップでエラーを処理
一般的なユーザーリクエスト
| ユーザーリクエスト | アクション |
|---|---|
| "发送邮件给xxx" | Mail を使用して作成および送信 |
| "提醒我明天..." | 期日付きのリマインダーを作成 |
| "添加日历事件" | カレンダーイベントを作成 |
| "打开xxx网站" | Safari で URL を開く |
| "调低音量" | 音量を下げる |
| "显示通知" | 通知を表示 |
| "打开文件夹" | Finder で表示 |
トラブルシューティング
AppleScript が失敗した場合:
- アプリがインストールされているか確認
- システム環境設定で権限を確認
- アプリ名が正確であることを確認
- 最初にアプリを手動で実行してみる
- スクリプトに構文エラーがないか確認
権限の問題については、ユーザーを以下に誘導してください。 システム環境設定 > プライバシーとセキュリティ > 自動化
自己改善プロトコル
AppleScript の実行が失敗した場合、または予期しない結果が生じた場合は、このプロトコルに従って、スキルの参照ドキュメントを改善してください。
1. エラー分析
- 失敗の根本原因を特定
- コードの問題、権限の問題、または概念的な誤解のいずれであるかを判断
- エラーが再現可能かどうかを確認
2. 参照ファイルのレビュー
references/ディレクトリにある関連する参照ファイルを見つけます- 類似のパターンの既存の例を確認します
- エラーが不正確または不完全な例に起因するかどうかを特定
3. ドキュメントの更新
参照ドキュメントで修正可能な問題を特定した場合:
不正確な例の場合:
- 正しい実装でサンプルコードを更新
(原文はここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Mac Automation via AppleScript
This skill enables control of macOS applications and system functions through AppleScript execution via the osascript command.
Core Principle
Execute AppleScript commands using the Bash tool with osascript:
osascript -e 'AppleScript code here'
For multi-line scripts:
osascript <<'EOF'
tell application "App Name"
-- commands here
end tell
EOF
Supported Applications & Functions
1. Mail (邮件)
- Send emails with subject, body, recipients
- Read unread emails
- Search emails
- Create drafts
2. Reminders (提醒事项)
- Create reminders with due dates
- List reminders by list
- Complete/delete reminders
- Create reminder lists
3. Calendar (日历)
- Create events with time, location, notes
- List today's/upcoming events
- Delete events
- Create calendars
4. Notification Center (通知中心)
- Display system notifications
- Custom title, subtitle, message
- Sound alerts
5. Safari
- Open URLs
- Get current page info
- Execute JavaScript
- Manage tabs and windows
6. Finder
- Open folders
- Get/set file info
- Move, copy, delete files
- Create folders
- Reveal files
7. System Controls (系统控制)
- Volume control (mute, set level)
- Brightness (via external tools)
- Open applications
- System info queries
- Sleep/restart/shutdown (with care)
8. Third-Party Applications
Many third-party apps support AppleScript. Common categories include development tools (iTerm2, VS Code), task management (OmniFocus, Things), media players (Spotify), browsers (Chrome), and communication tools. To check if an app supports AppleScript, open Script Editor to browse its dictionary, or try basic commands like tell application "AppName" to get name.
Execution Guidelines
Security Considerations
-
Permission Prompts: First-time use of certain apps triggers macOS permission dialogs. Inform user if automation fails due to permissions.
-
Sensitive Operations: For destructive operations (delete, shutdown), confirm with user before executing.
-
Privacy-Sensitive Data: When reading emails or calendar events, only display what user explicitly requests.
Error Handling
Common errors and solutions:
"Application not found"→ Check app name spelling"Not authorized"→ Guide user to System Preferences > Privacy & Security"Can't get..."→ Resource doesn't exist, handle gracefully
Best Practices
- Use exact app names: "Mail", "Reminders", "Calendar", "Safari", "Finder"
- Escape special characters: Use
\"for quotes in strings - Handle Unicode: AppleScript handles Chinese/Unicode natively
- Check app state: Some operations require app to be running
Quick Reference
Notifications
osascript -e 'display notification "消息内容" with title "标题"'
Open Application
osascript -e 'tell application "AppName" to activate'
Volume Control
# Get volume
osascript -e 'output volume of (get volume settings)'
# Set volume (0-100)
osascript -e 'set volume output volume 50'
# Mute
osascript -e 'set volume output muted true'
System Commands
# Get clipboard
osascript -e 'the clipboard'
# Set clipboard
osascript -e 'set the clipboard to "text"'
Additional Resources
Reference Files
For detailed AppleScript patterns by application, consult:
references/mail-applescript.md- Email operations: send, read, search, draftsreferences/reminders-applescript.md- Reminder operations: create, list, completereferences/calendar-applescript.md- Calendar operations: events, calendarsreferences/safari-applescript.md- Safari operations: URLs, tabs, JavaScriptreferences/finder-applescript.md- Finder operations: files, foldersreferences/system-applescript.md- System controls: volume, apps, clipboard
Example Files
Working examples in examples/:
daily-briefing.applescript- Get today's calendar and unread emailsquick-note.applescript- Create reminder from clipboard
Utility Scripts
Scripts in scripts/:
run-applescript.sh- Wrapper for safe AppleScript execution
Workflow Patterns
Pattern 1: Information Retrieval
- Execute AppleScript to query data
- Parse output
- Present formatted results to user
Pattern 2: Action Execution
- Confirm action with user if destructive
- Execute AppleScript
- Verify success
- Report result
Pattern 3: Multi-App Automation
- Chain multiple AppleScript calls
- Pass data between calls using shell variables
- Handle errors at each step
Common User Requests
| User Request | Action |
|---|---|
| "发送邮件给xxx" | Use Mail to create and send |
| "提醒我明天..." | Create Reminder with due date |
| "添加日历事件" | Create Calendar event |
| "打开xxx网站" | Safari open URL |
| "调低音量" | Set volume lower |
| "显示通知" | Display notification |
| "打开文件夹" | Finder reveal |
Troubleshooting
If AppleScript fails:
- Check app is installed
- Verify permissions in System Preferences
- Ensure app name is exact
- Try running app manually first
- Check for syntax errors in script
For permission issues, guide user to: System Preferences > Privacy & Security > Automation
Self-Improvement Protocol
When an AppleScript execution fails or produces unexpected results, follow this protocol to improve the skill's reference documentation:
1. Error Analysis
- Identify the root cause of the failure
- Determine if it's a code issue, permission issue, or conceptual misunderstanding
- Check if the error is reproducible
2. Reference File Review
- Locate the relevant reference file in
references/directory - Review existing examples for similar patterns
- Identify if the error stems from incorrect or incomplete examples
3. Documentation Update
When you identify a fixable issue in the reference documentation:
For incorrect examples:
- Update the example code with the correct implementation
- Add inline comments explaining the fix
- Test the corrected code to verify it works
For missing edge cases:
- Add a new example demonstrating the correct approach
- Include explanatory comments about why this approach is needed
For common pitfalls:
- Add a "Common Pitfalls" or "Important Notes" section
- Document the error message users might encounter
- Explain the correct solution
4. Update Guidelines
Use the Edit tool to modify reference files:
Edit tool on: references/{app}-applescript.md
- Fix incorrect code examples
- Add warning notes for known issues
- Include error messages and solutions
5. Documentation Standards
When updating reference files, maintain:
- Clear, working code examples
- Inline comments for complex logic
- Error messages and their solutions
- Date-stamped notes for significant fixes
6. Version Tracking
After significant improvements:
- Update the version number in SKILL.md frontmatter
- Consider documenting major fixes in a changelog
This protocol ensures the skill continuously improves based on real-world usage and errors encountered.
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (7,677 bytes)
- 📎 references/calendar-applescript.md (8,009 bytes)
- 📎 references/finder-applescript.md (8,226 bytes)
- 📎 references/mail-applescript.md (5,511 bytes)
- 📎 references/reminders-applescript.md (7,097 bytes)
- 📎 references/safari-applescript.md (6,605 bytes)
- 📎 references/system-applescript.md (8,397 bytes)