Apple Notes
Interact with Notes.app via AppleScript. Run scripts from: INLINECODE0
Commands
| Command | Usage |
|---|
| List folders | INLINECODE1 |
| List notes |
scripts/notes-list.sh [folder] [limit] |
| Read note |
scripts/notes-read.sh <name-or-id> [folder] |
| Create note |
scripts/notes-create.sh <folder> <title> [body] |
| Search notes |
scripts/notes-search.sh <query> [folder] [limit] [--title-only] |
| Edit note |
scripts/notes-edit.sh <name-or-id> <new-body> [folder] |
| Delete note |
scripts/notes-delete.sh <name> <folder> ⚠️ folder required |
Folder Paths
All commands support subfolder paths with / separator:
CODEBLOCK0
Folder Tree Structure
This collection has 4000+ notes. Key structure:
- - Scanned — parent folder with many subfolders (Medical & Health, Receipts, etc.)
- Fetish — parent with subfolders (AW, Bimbo, Events, etc.)
- Hobbies — parent with subfolders (3d printing, Homelab, etc.)
- Property — subfolders per address
Use --tree --counts to see the full hierarchy.
Folder Listing
CODEBLOCK1
Listing Notes
CODEBLOCK2
Without a folder, output includes the folder column: ID | Date | Folder | Title
With a folder: INLINECODE11
Reading Notes
CODEBLOCK3
Output: Title, Folder, Modified date, ID, then body text.
Searching
Title search first (fast), body search fallback (slower):
CODEBLOCK4
Output: INLINECODE12
Creating Notes
CODEBLOCK5
Returns the created note's ID.
Editing Notes
CODEBLOCK6
Deleting Notes
CODEBLOCK7
⚠️ Folder argument is required for safety — prevents accidental matches across 4000+ notes.
Performance Tips
| Situation | Tip |
|---|
| Listing/searching all notes | Always specify a folder — iterating 4000+ notes is slow |
| Reading a known note |
Use the
ID from a previous list/search — instant lookup |
| Searching large folders | Use
--title-only if body search isn't needed |
| Finding the right folder | Use
--tree --counts first to see hierarchy |
Errors
| Error | Cause |
|---|
| INLINECODE15 | Folder name doesn't exist or wrong path |
| INLINECODE16 |
No partial match found in scope |
| Empty body text | Scanned/image-only notes have no extractable text |
Technical Notes
- - Partial name matching for read/edit/delete (first match wins)
- Multiline body supported via temp files
- Folder names are case-sensitive
- All user inputs escaped for AppleScript safety (quotes, backslashes)
- INLINECODE17 used instead of
count of (AppleScript reserved word)
Apple Notes
通过AppleScript与Notes.app交互。从以下路径运行脚本:cd {baseDir}
命令
| 命令 | 用法 |
|---|
| 列出文件夹 | scripts/notes-folders.sh [--tree] [--counts] |
| 列出笔记 |
scripts/notes-list.sh [folder] [limit] |
| 读取笔记 | scripts/notes-read.sh
[folder] |
| 创建笔记 | scripts/notes-create.sh [body] |
| 搜索笔记 | scripts/notes-search.sh [folder] [limit] [--title-only] |
| 编辑笔记 | scripts/notes-edit.sh [folder] |
| 删除笔记 | scripts/notes-delete.sh ⚠️ 必须指定文件夹 |
文件夹路径
所有命令均支持使用 / 分隔符的子文件夹路径:
bash
scripts/notes-list.sh Scanned/Medical & Health 10
scripts/notes-read.sh blood test Scanned/Medical & Health
scripts/notes-create.sh Property/416 Garfield Inspection notes Roof looks good
文件夹树形结构
此集合包含4000+条笔记。主要结构:
- - Scanned — 父文件夹,包含多个子文件夹(Medical & Health、Receipts等)
- Fetish — 父文件夹,包含子文件夹(AW、Bimbo、Events等)
- Hobbies — 父文件夹,包含子文件夹(3d printing、Homelab等)
- Property — 按地址划分的子文件夹
使用 --tree --counts 查看完整层级结构。
文件夹列表
bash
scripts/notes-folders.sh # 平面列表
scripts/notes-folders.sh --counts # 显示笔记数量
scripts/notes-folders.sh --tree --counts # 完整层级结构及数量
列出笔记
bash
scripts/notes-list.sh Notes 10 # 指定文件夹
scripts/notes-list.sh Scanned/Receipts 5 # 子文件夹
scripts/notes-list.sh 10 # 所有文件夹(每条笔记显示文件夹名称)
不指定文件夹时,输出包含文件夹列:ID | Date | Folder | Title
指定文件夹时:ID | Date | Title
读取笔记
bash
scripts/notes-read.sh blood test Scanned/Medical & Health # 按名称(部分匹配)
scripts/notes-read.sh x-coredata://…/ICNote/p12345 # 按ID(直接查找,速度快)
输出:标题、文件夹、修改日期、ID,然后是正文内容。
搜索
优先搜索标题(速度快),标题搜索无结果时回退到正文搜索(速度较慢):
bash
scripts/notes-search.sh tax 10 # 所有文件夹
scripts/notes-search.sh receipt Scanned/Receipts 5 # 指定文件夹
scripts/notes-search.sh keyword 10 --title-only # 跳过正文搜索
输出:ID | Date | Folder | Title
创建笔记
bash
scripts/notes-create.sh Notes My Title Body text here # 带正文
scripts/notes-create.sh Notes Empty Note # 仅标题
返回创建笔记的ID。
编辑笔记
bash
scripts/notes-edit.sh My Note New body content Notes # 按名称
scripts/notes-edit.sh x-coredata://…/ICNote/p12345 New body # 按ID
删除笔记
bash
scripts/notes-delete.sh Old Note Notes # 必须指定文件夹
scripts/notes-delete.sh receipt Scanned/Receipts
⚠️ 出于安全考虑,必须指定文件夹参数——防止在4000+条笔记中意外匹配。
性能提示
| 情况 | 提示 |
|---|
| 列出/搜索所有笔记 | 始终指定文件夹——遍历4000+条笔记速度较慢 |
| 读取已知笔记 |
使用之前列表/搜索中的ID——即时查找 |
| 搜索大文件夹 | 如果不需要正文搜索,使用 --title-only |
| 查找正确的文件夹 | 先使用 --tree --counts 查看层级结构 |
错误信息
| 错误 | 原因 |
|---|
| Error: Cant get folder | 文件夹名称不存在或路径错误 |
| No note matching… |
在范围内未找到部分匹配项 |
| 正文内容为空 | 扫描件/纯图片笔记无可提取文本 |
技术说明
- - 读取/编辑/删除支持部分名称匹配(匹配第一个结果)
- 多行正文通过临时文件支持
- 文件夹名称区分大小写
- 所有用户输入均经过转义以确保AppleScript安全(引号、反斜杠)
- 使用 number of 而非 count of(AppleScript保留字)