Apple Notes命令行工具

基于AppleScript的快速命令行工具,用于管理Apple Notes,支持创建、列出、搜索、读取、删除笔记等功能。

  • by mjohnson139
  • Shell
  • 本地部署
  • 更新于
在 GitHub 查看 mjohnson139/apple-notes-mcp

使用说明

快速Apple Notes命令行界面工具

基于AppleScript的闪电般快速的工具,用于从命令行管理Apple Notes。

演出

这些脚本是 速度提高18-120倍 比 macnotesapp CLI工具:

  • 创建笔记:~1s(vs 16s)
  • 列表注释:~4s(vs 24s)
  • 搜索笔记:~3s(vs未知)

命令

1.创建注释

./create_note.sh "Note Title" "FolderName" < content.html

示例:

# Create in default "Notes" folder
./create_note.sh "My New Note" "Notes" << 'EOF'
<h1>Hello World</h1>
<p>This is <b>bold</b> and <i>italic</i> text.</p>
<ul>
  <li>Bullet point 1</li>
  <li>Bullet point 2</li>
</ul>
EOF

# Create in "Projects" folder
./create_note.sh "Project Plan" "Projects" << 'EOF'
<h2>Q4 Goals</h2>
<ul><li>Goal 1</li><li>Goal 2</li></ul>
EOF

2.列表注释

# List 10 most recent notes (default)
./list_notes.sh

# List 20 most recent notes
./list_notes.sh "" 20

# List notes in specific folder
./list_notes.sh "Projects"

# List first 5 notes in folder
./list_notes.sh "Projects" 5

3.搜索注释

# Search by name (default)
./search_notes.sh "search term"

# Search in note body/content
./search_notes.sh "search term" --body

# Search both name and body
./search_notes.sh "search term" --both

4.阅读注释

# Read note (text format with headers)
./read_note.sh "Note Title"

# Read note (raw HTML)
./read_note.sh "Note Title" --html

注: 如果多个音符匹配,它会显示第一个带有警告的音符。

5.获取笔记URL/ID

# Get the unique ID for notes
./get_note_url.sh "Note Title"

这将以以下格式返回钞票ID: x-coredata://...

6.删除注释

# Delete a note by searching for its title
./delete_note.sh "Note Title"

# Delete a specific note by ID (for exact deletion)
./delete_note.sh "x-coredata://D8A3FA68-9A3A-4CB9-BC5A-D675F7098844/ICNote/p1234"

注: 这将笔记移动到“最近删除”文件夹,可以在30天内恢复。如果多个笔记按标题匹配,它将显示它们的ID——使用特定的ID删除您想要的确切笔记。

HTML格式指南

Apple Notes支持以下HTML标签:

标题

<h1>Main Title</h1>
<h2>Section Title</h2>
<h3>Subsection</h3>

文本格式化

<b>Bold text</b>
<i>Italic text</i>
<u>Underlined text</u>

列表

<!-- Bullet list -->
<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

<!-- Numbered list -->
<ol>
  <li>First</li>
  <li>Second</li>
</ol>

<!-- Nested lists -->
<ul>
  <li>Item 1
    <ul>
      <li>Sub-item 1</li>
      <li>Sub-item 2</li>
    </ul>
  </li>
</ul>

其它要素

<hr>           <!-- Horizontal line -->
<p>Paragraph</p>
&amp;          <!-- Ampersand (&) -->
&lt;           <!-- Less than (<) -->
&gt;           <!-- Greater than (>) -->

表情符号

直接使用表情符号:🎯 💪 📚 🏠 👥 💰 🎨 📝

交互式检查表

重要提示: 交互式复选框不能以编程方式创建。

解决方法:

  1. 使用常规项目符号创建注释
  2. 在Notes.app中打开
  3. 选择行并按 Shift+Cmd+L 转换为检查表

可用文件夹

常见文件夹示例:

  • 注释(默认)
  • 项目
  • 工作
  • 个人
  • 想法

您可以在Apple Notes中创建和组织自己的文件夹。跑 ./list_notes.sh 查看您的可用文件夹。

提示

  1. 速度: 这些脚本比旧的快得多 notes CLI工具
  2. 头脑风暴: 使用这些功能从终端快速捕获格式化的笔记
  3. 集成: 易于与其他脚本和自动化集成
  4. 预览: Notes在Notes.app中自动打开 --show 内置行为