Apple Notes (AppleScript)
Scanned@shad0wca7
npx machina-cli add skill @shad0wca7/apple-notes-applescript --openclawApple Notes
Interact with Notes.app via AppleScript. Run scripts from: cd {baseDir}
Commands
| Command | Usage |
|---|---|
| List folders | scripts/notes-folders.sh [--tree] [--counts] |
| 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:
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"
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
scripts/notes-folders.sh # Flat list
scripts/notes-folders.sh --counts # With note counts
scripts/notes-folders.sh --tree --counts # Full hierarchy with counts
Listing Notes
scripts/notes-list.sh "Notes" 10 # Specific folder
scripts/notes-list.sh "Scanned/Receipts" 5 # Subfolder
scripts/notes-list.sh "" 10 # All folders (shows folder name per note)
Without a folder, output includes the folder column: ID | Date | Folder | Title
With a folder: ID | Date | Title
Reading Notes
scripts/notes-read.sh "blood test" "Scanned/Medical & Health" # By name (partial match)
scripts/notes-read.sh "x-coredata://…/ICNote/p12345" # By ID (direct lookup, fast)
Output: Title, Folder, Modified date, ID, then body text.
Searching
Title search first (fast), body search fallback (slower):
scripts/notes-search.sh "tax" "" 10 # All folders
scripts/notes-search.sh "receipt" "Scanned/Receipts" 5 # Specific folder
scripts/notes-search.sh "keyword" "" 10 --title-only # Skip body search
Output: ID | Date | Folder | Title
Creating Notes
scripts/notes-create.sh "Notes" "My Title" "Body text here" # With body
scripts/notes-create.sh "Notes" "Empty Note" # Title only
Returns the created note's ID.
Editing Notes
scripts/notes-edit.sh "My Note" "New body content" "Notes" # By name
scripts/notes-edit.sh "x-coredata://…/ICNote/p12345" "New body" # By ID
Deleting Notes
scripts/notes-delete.sh "Old Note" "Notes" # Folder required
scripts/notes-delete.sh "receipt" "Scanned/Receipts"
⚠️ 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 |
|---|---|
Error: Can't get folder | Folder name doesn't exist or wrong path |
No note matching… | 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)
number ofused instead ofcount of(AppleScript reserved word)
Overview
Apple Notes via AppleScript lets you automate Notes.app on macOS. This skill supports listing folders, reading, creating, searching, editing, and deleting notes using shell scripts that wrap AppleScript calls. It helps manage large collections (4000+ notes) by enforcing folder scoping and fast ID-based lookups.
How This Skill Works
You run scripts from the baseDir (cd {baseDir}) and call commands like notes-folders.sh, notes-list.sh, notes-read.sh, notes-create.sh, notes-search.sh, notes-edit.sh, and notes-delete.sh. Each command accepts a folder path using slash separators and returns structured results (IDs, dates, titles). Folder scoping improves performance and safety.
When to Use It
- Organize and audit a 4000+ note library by listing folders and contents.
- Read or preview a specific note by name or ID for quick verification.
- Create a new note in a chosen folder with a title and body.
- Search across notes by title or body, optionally confined to a folder.
- Delete a note only after specifying its folder to avoid accidental matches.
Quick Start
- Step 1: cd to your baseDir where the Apple Notes scripts live
- Step 2: run scripts/notes-folders.sh to locate a target folder, then a listing or read/create command as needed
- Step 3: run the appropriate script with a folder and name/id to perform the action
Best Practices
- Always specify a folder when listing, searching, editing, or deleting to avoid slow or broad results.
- Use the ID lookups (e.g., x-coredata://…/ICNote/p12345) for fast access when editing or deleting.
- Prefer --title-only to speed up large-folder searches if body content isn't needed.
- Validate that the target folder path exists before running actions.
- Test scripts in a small, safe folder before applying to large collections.
Example Use Cases
- scripts/notes-folders.sh --tree --counts # view full hierarchy with counts
- scripts/notes-list.sh "Scanned/Receipts" 5 # list notes in a subfolder
- scripts/notes-read.sh "blood test" "Scanned/Medical & Health" # read a note by name
- scripts/notes-create.sh "Notes" "My Title" "Body text here" # create a new note
- scripts/notes-delete.sh "Old Note" "Notes" # delete a note in a specific folder