🤖
macOS Automator 完整學習筆記
macOS Automator Complete Study Notes
無需編程知識,讓 Mac 自動完成重複工作 ✦ 整合 Apple 官方資料
Automate repetitive tasks without coding ✦ Based on Apple Official Documentation
📋 目錄(點擊跳轉)Contents (Click to Jump)
Automator 是 Apple 隨 macOS 內建的免費自動化工具,讓你無需學習程式語言,只需以拖放方式組合「動作」,就能建立自動執行的工作流程。
Automator is a free automation tool built into macOS. Without any programming knowledge, you can drag and drop "actions" to build automated workflows.
| 特性 | 說明 |
| 📍 位置 | 應用程式資料夾 → Automator.app |
| 💰 費用 | 完全免費,macOS 內建 |
| 🔧 需要技術 | 不需要(可選擇性加入 Shell Script / AppleScript) |
| 📂 適用對象 | 任何 macOS 用戶,尤其適合有大量重複性工作者 |
| 🔗 整合 | 可與「捷徑」App、Finder、日曆等整合 |
💡 典型應用場景
批次重新命名 100 個檔案、將資料夾內所有圖片轉為 JPEG、自動壓縮新加入資料夾的檔案、定時執行備份工作等。
| Feature | Description |
| 📍 Location | Applications folder → Automator.app |
| 💰 Cost | Completely free, built into macOS |
| 🔧 Technical Skill | Not required (Shell Script / AppleScript optional) |
| 📂 Target Users | Any macOS user, especially those with repetitive tasks |
| 🔗 Integration | Works with Shortcuts App, Finder, Calendar, and more |
💡 Typical Use Cases
Batch rename 100 files, convert all images in a folder to JPEG, auto-compress newly added files, run scheduled backups, and more.
| 區域 | 名稱 | 功能 |
| ① 左上 | 程式庫(Library) | 顯示所有可用動作的分類清單 |
| ② 左下 | 動作列表 | 選擇類別後,顯示該類別所有動作 |
| ③ 中間 | 搜尋欄 | 快速搜尋特定動作 |
| ④ 右方 | 工作流程畫布 | 將動作拖入此處,依序排列形成工作流程 |
| ⑤ 右上 | 執行按鈕 | 點擊「執行」(▶) 測試工作流程 |
| ⑥ 底部 | 記錄面板 | 顯示執行記錄及錯誤訊息 |
💡 快速開啟 Automator
按
Command + Space 開啟 Spotlight,輸入「Automator」即可快速啟動。
| Area | Name | Function |
| ① Top Left | Action Library | Browse all available actions by category |
| ② Bottom Left | Action List | Lists all actions in the selected category |
| ③ Middle | Search Bar | Quickly find specific actions by keyword |
| ④ Right | Workflow Canvas | Drag actions here to build the workflow in sequence |
| ⑤ Top Right | Run Button | Click "Run" (▶) to test the workflow |
| ⑥ Bottom | Log Panel | Shows run logs and error messages |
💡 Quick Launch Automator
Press
Command + Space to open Spotlight, type "Automator", and press Enter.
| 類型 | 圖示 | 說明 | 適合場景 |
工作流程 Workflow |
📄 |
最基本的類型,需在 Automator 內手動執行 |
測試、學習用途 |
應用程式 Application |
🖥️ |
儲存成獨立的 .app 檔案,可雙擊執行或接受拖放檔案 |
常用自動化工具 |
快速動作 Quick Action |
⚡ |
出現在 Finder 右鍵選單、觸控欄及服務選單 |
對選取檔案快速操作 |
列印外掛模組 Print Plugin |
🖨️ |
出現在「列印」對話框 |
列印相關自動化 |
資料夾動作 Folder Action |
📁 |
附加至特定資料夾,有新檔案加入時自動執行 |
監控資料夾、自動處理新檔 |
日曆鬧鐘 Calendar Alarm |
📅 |
與「日曆」App 整合,在特定時間自動執行 |
定時自動化任務 |
相片捕捉外掛 Image Capture Plugin |
📷 |
在「相片捕捉」App 中使用 |
相機/掃描器影像處理 |
聽寫指令 Dictation Command |
🎤 |
語音指令觸發工作流程 |
語音控制 Mac |
| Type | Icon | Description | Best For |
Workflow Workflow |
📄 |
The most basic type; run manually inside Automator |
Testing & learning |
Application Application |
🖥️ |
Saved as a standalone .app file; double-click or drag files onto it |
Reusable automation tools |
Quick Action Quick Action |
⚡ |
Appears in Finder right-click menu, Touch Bar, and Services menu |
Quick operations on selected files |
Print Plugin Print Plugin |
🖨️ |
Appears in the Print dialog |
Print-related automation |
Folder Action Folder Action |
📁 |
Attached to a specific folder; triggers automatically when new files are added |
Monitor folders, auto-process new files |
Calendar Alarm Calendar Alarm |
📅 |
Integrates with Calendar app; runs at a scheduled time |
Timed automation tasks |
Image Capture Plugin Image Capture Plugin |
📷 |
Used within the Image Capture app |
Camera/scanner image processing |
Dictation Command Dictation Command |
🎤 |
Triggers a workflow via voice command |
Voice control for Mac |
-
1
開啟 Automator
前往「應用程式」資料夾,找到 Automator.app 並雙擊開啟。或使用 Spotlight(⌘ + Space)搜尋「Automator」。
-
2
新增文件
選擇選單列「檔案」→「新增」(⌘ + N),彈出類型選擇視窗。
-
3
選擇工作流程類型
依照需求從 8 種類型中選擇(參考上表),然後點擊「選擇」。初學者建議先選「工作流程」或「應用程式」。
-
4
瀏覽並尋找動作
左側「程式庫」可按類別瀏覽(檔案和檔案夾、影像、PDF 等),或在搜尋欄直接輸入關鍵字。
-
5
加入動作至工作流程
找到所需動作後,雙擊或拖放至右側工作流程畫布。動作會依序疊加,上方動作的輸出會成為下一個動作的輸入。
-
6
設定各動作參數
每個動作卡片都有可自訂的選項(如檔名前綴、圖片大小、格式等),根據需要填寫或選擇。
-
7
測試執行
點擊右上角「執行」(▶)按鈕測試。底部記錄面板會顯示執行狀態與任何錯誤。
-
8
儲存工作流程
選擇「檔案」→「儲存」(⌘ + S)。若是「應用程式」類型,會儲存為可獨立執行的 .app 檔案。
⚠️ 重要提示
執行前務必在測試資料夾或備份的檔案上試驗,部分動作(如刪除、移動)不可逆轉,若操作真實檔案可能造成資料損失。
-
1
Open Automator
Go to the Applications folder, find Automator.app, and double-click. Or use Spotlight (⌘ + Space) and search "Automator".
-
2
Create a New Document
From the menu bar choose File → New (⌘ + N) to open the workflow type selector.
-
3
Choose a Workflow Type
Pick one of the 8 types based on your needs (see table above), then click Choose. Beginners are recommended to start with Workflow or Application.
-
4
Browse and Find Actions
Use the Library panel on the left to browse by category (Files & Folders, Images, PDF, etc.), or type a keyword into the search bar.
-
5
Add Actions to the Workflow
Double-click or drag an action onto the workflow canvas on the right. Actions are chained in order — the output of one becomes the input of the next.
-
6
Configure Action Parameters
Each action card has customisable options (e.g. filename prefix, image size, format). Fill in or select the desired values.
-
7
Test Run
Click the Run button (▶) in the top-right corner. The log panel at the bottom shows the run status and any errors.
-
8
Save the Workflow
Choose File → Save (⌘ + S). An Application-type workflow is saved as a standalone .app file.
⚠️ Important Note
Always test on sample or backed-up files first. Some actions (e.g. Delete, Move) are irreversible and may cause data loss if run on your real files.
情景:你有 50 張會議截圖,想將它們重命名為「Meeting_001.png」、「Meeting_002.png」⋯
Scenario: You have 50 meeting screenshots and want to rename them as "Meeting_001.png", "Meeting_002.png"…
-
1
開啟 Automator → 選擇類型:「工作流程」
-
2
在程式庫搜尋「
取得指定的 Finder 項目」→ 雙擊加入
-
3
搜尋「
重新命名 Finder 項目」→ 雙擊加入
- 下拉選單選「加入文字」或「製作連續號碼」
- 選擇「製作連續號碼」,設定開始數字為 1、位數為 3
- 在「新名稱」欄填入
Meeting_,位置選「名稱開頭之前」
-
4
點擊右上「執行」→ 確認底部記錄無錯誤
-
5
儲存工作流程以備下次使用(⌘ + S)
💡 小技巧
若儲存為「應用程式」類型,下次只需把要改名的檔案直接拖到 .app 圖示上即可自動執行,無需開啟 Automator。
-
1
Open Automator → Choose type: Workflow
-
2
Search the library for
"Get Specified Finder Items" → double-click to add
- Click "Add" inside the action and select all the files to rename
-
3
Search for
"Rename Finder Items" → double-click to add
- Choose "Make Sequential" from the dropdown
- Set start number to 1 and digit count to 3
- Enter
Meeting_ as the new name, position set to "Before Name"
-
4
Click Run in the top-right → confirm no errors in the log panel
-
5
Save the workflow for future use (⌘ + S)
💡 Pro Tip
Save as an Application type — next time just drag the files directly onto the .app icon to run automatically, no need to open Automator.
情景:將資料夾內所有 PNG 圖片轉換為 JPEG,並縮小至最大寬度 1024px。
Scenario: Convert all PNG images in a folder to JPEG and resize to a maximum width of 1024px.
-
1
開啟 Automator → 選擇類型:
「快速動作」
-
2
-
3
-
4
儲存工作流程,命名為「轉換並縮小圖片」
-
5
使用方式:在 Finder 選取圖片 → 右鍵 → 「快速動作」→「轉換並縮小圖片」
⚠️ 注意
「更改影像類型」動作會直接覆蓋原始檔案。建議在動作之前先加入「複製 Finder 項目」動作,以保留原檔備份。
其他常見圖片動作:
- 「旋轉影像」— 批次旋轉 90°/180°/270°
- 「裁切影像」— 批次裁切至指定大小
- 「翻轉影像」— 水平或垂直翻轉
- 「加上濾鏡至影像」— 套用 Core Image 濾鏡效果
-
1
Open Automator → Choose type:
Quick Action
- Set "Workflow receives: Image Files"
-
2
In the library, select the "Images" category → add the
Scale Images action
- Set to "By Percentage" or "To Size (pixels)" with width
1024
-
3
Add the
Change Type of Images action
-
4
Save the workflow and name it "Convert and Resize Images"
-
5
To use: select images in Finder → right-click → Quick Actions → "Convert and Resize Images"
⚠️ Note
The "Change Type of Images" action overwrites the originals. Consider adding a "Copy Finder Items" action before it to keep a backup.
Other Common Image Actions:
- "Rotate Images" — batch rotate by 90°/180°/270°
- "Crop Images" — batch crop to a specified size
- "Flip Images" — flip horizontally or vertically
- "Apply Quartz Composition Filter to Images" — apply Core Image filter effects
Automator 提供多個 PDF 相關動作,以下示範合併多個 PDF 成單一檔案:
Automator has many PDF-related actions. The example below demonstrates merging multiple PDFs into a single file:
-
1
開啟 Automator → 選擇類型:「應用程式」
-
2
程式庫搜尋「取得指定的 Finder 項目」→ 加入
-
3
搜尋「
排序 Finder 項目」→ 加入
- 設定按「名稱」升序排列,確保 PDF 合併順序正確
-
4
-
5
儲存為「合併PDF.app」,之後把多個 PDF 檔案拖到 app 圖示即可自動合併
| PDF 動作 | 功能說明 |
| 合併 PDF 頁面 | 將多個 PDF 合併成一個文件 |
| PDF 頁面加上浮水印 | 在每頁加上文字或圖片浮水印 |
| 取出 PDF 文字 | 提取 PDF 內的文字內容 |
| 新增 PDF 密碼 | 為 PDF 加上開啟或複製的密碼保護 |
| PDF 轉為影像 | 將 PDF 每頁轉換為 PNG / JPEG 影像 |
-
1
Open Automator → Choose type: Application
-
2
Search the library for "Get Specified Finder Items" → add it
-
3
Search for
"Sort Finder Items" → add it
- Set to sort by "Name" ascending to ensure correct merge order
-
4
Search for
"Combine PDF Pages" → add it
- Choose "Appending Pages", set output file name and location
-
5
Save as "MergePDF.app" — then just drag multiple PDFs onto the app icon to auto-merge
| PDF Action | Description |
| Combine PDF Pages | Merge multiple PDFs into one document |
| Watermark PDF Documents | Add text or image watermarks to every page |
| Extract PDF Text | Extract plain text content from a PDF |
| Encrypt PDF Documents | Password-protect a PDF for opening or copying |
| Render PDF Pages as Images | Convert each PDF page to PNG / JPEG image |
「資料夾動作」讓特定資料夾變成智能處理器——每當有新檔案加入,指定的工作流程就會自動執行。
"Folder Actions" turn a specific folder into a smart processor — every time a new file is added, the assigned workflow runs automatically.
-
1
開啟 Automator → 選擇類型:「資料夾動作」
-
2
在視窗頂部「資料夾動作接收加入至:」下拉選單中,選擇要監控的資料夾(或按「其他」指定路徑)
-
3
在程式庫中加入所需動作(例如:「複製 Finder 項目」、「壓縮 Finder 項目」)
-
4
設定動作參數(如複製目標位置)
-
5
儲存工作流程(⌘ + S),Automator 會自動將此動作附加至該資料夾
-
6
啟用資料夾動作: 在 Finder 右鍵點擊監控資料夾 → 「服務」→「資料夾動作設定」→ 確保已勾選啟用
💡 實用範例
設定「下載項目」資料夾動作:每當有新檔案下載,自動將其移至按月分類的子資料夾(如 2026-04)。
⚠️ 注意事項
資料夾動作在 macOS 背景常駐運行。若發現 Mac 有不明自動動作,請到 Finder 右鍵目標資料夾 →「資料夾動作設定」檢查。
-
1
Open Automator → Choose type: Folder Action
-
2
At the top of the window, use the "Folder Action receives files added to:" dropdown to choose the folder to monitor (or click "Other" to specify a path)
-
3
Add the desired actions from the library (e.g. "Copy Finder Items", "Compress Finder Items")
-
4
Configure action parameters (e.g. copy destination)
-
5
Save the workflow (⌘ + S) — Automator will automatically attach it to the selected folder
-
6
Enable Folder Actions: Right-click the folder in Finder → Services → Folder Action Setup → make sure it is checked as enabled
💡 Practical Example
Set a Folder Action on the Downloads folder: whenever a new file is downloaded, automatically move it to a month-based subfolder (e.g. 2026-04).
⚠️ Note
Folder Actions run in the macOS background. If you notice unexpected automatic actions on your Mac, check Finder right-click on the target folder → Folder Action Setup.
當內建動作不足時,可在工作流程中嵌入自訂 Shell Script(bash/zsh)或 AppleScript,大幅擴展 Automator 能力。
When built-in actions are not enough, you can embed custom Shell Scripts (bash/zsh) or AppleScript into your workflow to greatly extend Automator's capabilities.
-
1
在程式庫搜尋「執行 Shell 工序指令」→ 雙擊加入
-
2
設定「Shell」為 /bin/zsh(macOS 預設)或 /bin/bash
-
3
設定「傳入輸入項目」:以引數形式(處理前一動作傳入的檔案)
-
4
在文字區域輸入 Shell 指令
-
1
Search the library for "Run Shell Script" → double-click to add
-
2
Set Shell to /bin/zsh (macOS default) or /bin/bash
-
3
Set "Pass input" to: as arguments (to handle files from the previous action)
-
4
Type your Shell commands in the text area
範例:將所有傳入的文字檔轉換為大寫
Example: Convert all incoming text files to uppercase
for f in "$@"; do
tr '[:lower:]' '[:upper:]' < "$f" > "$f.tmp" && mv "$f.tmp" "$f"
done
範例:執行 AppleScript(彈出提示)
Example: Run AppleScript (show a dialog)
on run {input, parameters}
display dialog "工作流程已完成!共處理 " & (count input) & " 個檔案"
return input
end run
💡 取得 ChatGPT / AI 輔助撰寫指令
如不熟悉 Shell Script,可直接向 ChatGPT 描述需求(例如:「幫我寫一個 bash script,把所有 .txt 檔案中的換行符號改為逗號」),將生成的代碼貼入即可使用。
💡 Get Help from ChatGPT / AI
If you are not familiar with Shell Script, describe your need to ChatGPT (e.g. "Write a bash script that replaces all newlines in .txt files with commas") and paste the generated code directly.
Apple 在近年版本的 macOS 中大力推廣「捷徑」(Shortcuts)App,並支援直接匯入舊有 Automator 工作流程,讓自動化任務更容易與 iPhone/iPad 協作使用。
Apple has been actively promoting the Shortcuts app in recent macOS versions. It supports importing legacy Automator workflows, making it easier to use automations across iPhone and iPad too.
-
1
在 Finder 找到已儲存的 Automator 工作流程檔案(.workflow 格式)
-
2
開啟「捷徑」App(可在應用程式資料夾找到)
-
3
將 .workflow 檔案直接拖入「捷徑」視窗
-
4
「捷徑」會自動轉換並建立對應的捷徑集合,可立即執行
-
1
In Finder, locate the saved Automator workflow file (.workflow format)
-
2
Open the Shortcuts app (found in the Applications folder)
-
3
Drag the .workflow file directly into the Shortcuts window
-
4
Shortcuts will automatically convert it and create a corresponding shortcut, ready to run
| 功能比較 | Automator | 捷徑(Shortcuts) |
| 平台 | macOS 專用 | macOS + iOS + iPadOS |
| 介面 | 傳統拖放式 | 現代視覺化積木式 |
| Shell Script | ✅ 支援 | ⚠️ 有限支援 |
| 資料夾動作 | ✅ 支援 | ❌ 不支援 |
| 跨裝置同步 | ❌ 不支援 | ✅ 透過 iCloud |
| 未來發展 | 逐漸被取代中 | Apple 主力推廣 |
⚠️ 重要提示
Apple 已宣告「捷徑」將逐步取代 Automator,但 Automator 在 macOS 上仍受支援。對於「資料夾動作」及複雜 Shell Script 任務,目前 Automator 仍更為強大。
| Feature | Automator | Shortcuts |
| Platform | macOS only | macOS + iOS + iPadOS |
| Interface | Traditional drag-and-drop | Modern visual block-based |
| Shell Script | ✅ Supported | ⚠️ Limited support |
| Folder Actions | ✅ Supported | ❌ Not supported |
| Cross-device Sync | ❌ Not supported | ✅ Via iCloud |
| Future Direction | Being gradually replaced | Apple's primary focus |
⚠️ Important Note
Apple has announced that Shortcuts will gradually replace Automator, but Automator is still fully supported on macOS. For Folder Actions and complex Shell Script tasks, Automator remains more powerful.
| 類別 | 常用動作 | 功能 |
📁 檔案與 資料夾 | 取得指定的 Finder 項目 | 手動選擇要處理的檔案 |
| 重新命名 Finder 項目 | 批次改名(加前綴/後綴/連續號碼) |
| 複製 Finder 項目 | 複製到指定位置 |
| 壓縮 Finder 項目 | 壓縮成 .zip 檔案 |
| 🖼️ 影像 | 縮放影像 | 調整圖片大小(px 或百分比) |
| 更改影像類型 | 轉換格式(JPEG/PNG/TIFF/GIF) |
| 旋轉影像 | 旋轉指定角度 |
| 裁切影像 | 裁切至指定尺寸 |
| 📄 PDF | 合併 PDF 頁面 | 合併多個 PDF |
| PDF 頁面加上浮水印 | 加文字或圖片浮水印 |
| 取出 PDF 文字 | 提取純文字 |
| 💬 文字 | 取得剪貼板的內容 | 使用剪貼板文字作為輸入 |
| 複製至剪貼板 | 將結果複製到剪貼板 |
| ⚙️ 工序指令 | 執行 Shell 工序指令 | 執行自訂 bash/zsh 指令 |
| 執行 AppleScript | 執行自訂 AppleScript 代碼 |
| 🌐 網路 | 取得指定的 URL | 從網址取得內容 |
| 下載 URL | 下載指定 URL 的檔案 |
| Category | Action | Function |
📁 Files & Folders | Get Specified Finder Items | Manually select files to process |
| Rename Finder Items | Batch rename (add prefix/suffix/sequential number) |
| Copy Finder Items | Copy to a specified location |
| Compress Finder Items | Compress into a .zip file |
| 🖼️ Images | Scale Images | Resize images (by px or percentage) |
| Change Type of Images | Convert format (JPEG/PNG/TIFF/GIF) |
| Rotate Images | Rotate by a specified angle |
| Crop Images | Crop to a specified size |
| 📄 PDF | Combine PDF Pages | Merge multiple PDFs |
| Watermark PDF Documents | Add text or image watermarks |
| Extract PDF Text | Extract plain text content |
| 💬 Text | Get Contents of Clipboard | Use clipboard text as input |
| Copy to Clipboard | Copy results to the clipboard |
| ⚙️ Scripts | Run Shell Script | Execute custom bash/zsh commands |
| Run AppleScript | Execute custom AppleScript code |
| 🌐 Internet | Get Specified URLs | Fetch content from a URL |
| Download URLs | Download files from specified URLs |
📌 速查總表
📌 Quick Reference
🚀 開啟 Automator
⌘ + Space → 輸入「Automator」→ Enter
📄 新增工作流程
⌘ + N → 選擇類型 → 選擇
▶️ 執行測試
點擊右上角「執行」按鈕,或按 ⌘ + R
💾 儲存工作流程
⌘ + S,應用程式類型會存為 .app
📁 資料夾動作啟用
Finder 右鍵資料夾 → 服務 → 資料夾動作設定
⚡ 快速動作使用
Finder 選取檔案 → 右鍵 → 快速動作
🔗 匯入至捷徑
將 .workflow 拖入「捷徑」App 視窗
🐚 Shell Script
程式庫搜尋「執行 Shell 工序指令」→ Shell: /bin/zsh
🖼️ 批次圖片轉換
快速動作 → 縮放影像 + 更改影像類型
📝 批次改名
取得項目 → 重新命名 Finder 項目 → 執行
📄 合併 PDF
取得項目 → 排序 → 合併 PDF 頁面
⚠️ 執行前
務必先在測試檔案上試驗,部分動作不可逆!
🚀 Open Automator
⌘ + Space → type "Automator" → Enter
📄 New Workflow
⌘ + N → Choose type → Choose
▶️ Run Test
Click the Run button or press ⌘ + R
💾 Save Workflow
⌘ + S; Application type saves as .app
📁 Enable Folder Action
Finder right-click folder → Services → Folder Action Setup
⚡ Use Quick Action
Select files in Finder → right-click → Quick Actions
🔗 Import to Shortcuts
Drag .workflow into the Shortcuts App window
🐚 Shell Script
Search library "Run Shell Script" → Shell: /bin/zsh
🖼️ Batch Image Convert
Quick Action → Scale Images + Change Type of Images
📝 Batch Rename
Get Items → Rename Finder Items → Run
📄 Merge PDF
Get Items → Sort → Combine PDF Pages
⚠️ Before Running
Always test on sample files first — some actions are irreversible!
整合 Apple 官方 Automator 使用手冊(support.apple.com/zh-hk/guide/automator)
筆記製作:2026年4月 ✦ 適用 macOS Sequoia 及以上版本
Based on Apple Official Automator User Guide (support.apple.com/guide/automator)
Notes compiled: April 2026 ✦ Applies to macOS Sequoia and later