Code base enhanced from notes-export/notesExport.applescript at master Β· robertgaal/notes-export
added selection on folder level and individual notes
copy the script to Apple script editor and run it.
This script exports Apple Notes to formatted HTML files with:
- Preserved folder structure
- Attachments handling (audio/video/PDF embeds)
- Clean HTML formatting
- Open Graph metadata support
- Customizable templates
- Multi-account support
-
Run the Script
Double-click the.applescriptfile or run via Script Editor -
Select Account
Choose which Notes account to export from -
Choose Folders
Select specific folders or "All Notes" -
Pick Output Location
Select a destination folder (empty directory recommended) -
Let It Run
The script will:- Create mirrored folder structure
- Export notes as HTML
- Save attachments
- Clean up formatting
- Add metadata headers
flowchart TD
A[Start Script] --> B[Select Notes Account]
B --> C[Choose Folders to Export]
C --> D[Select Output Folder]
D --> E[Process Notes]
E --> F[Export HTML + Attachments]
F --> G[Clean HTML Formatting]
G --> H[Add Metadata Headers]
H --> I[Complete Export]
Modify the CSS in the wrapHTML handler:
Supported formats in attList loop:
- Video: .webm, .mp4, .mov
- Audio: .ogg, .mp3, .m4a
- Documents: .pdf
Adjust sanitization rules:
set baseFileName to my replaceText(baseFileName, ":", "-")
set baseFileName to my replaceText(baseFileName, "/", "-")Modify preProcessHTML for different cleanup needs:
repeat while fileContent contains "<br><br>"
set fileContent to my replaceText(fileContent, "<br><br>", "<br>")
end repeatExportFolder/
βββ Folder1/
β βββ Note1.html
β βββ attachments/
β βββ video.mp4
β βββ doc.pdf
βββ Folder2/
βββ Note2.html
βββ Subfolder/
βββ Note3.html
- Requires macOS Catalina (10.15) or newer
- Needs permission to access Notes app
- Password-protected notes are skipped
- First run may require:
- System Preferences > Security & Privacy > Automation
- Check "Script Editor" and "Notes"
The script includes:
- File access error recovery
- Attachment failure fallbacks
- User-friendly error dialogs
- Cleanup routines for partial exports
Can safely export multiple times - overwrites existing files but preserves folder structure.
This script creates a reminder from a selected note in Apple Notes with:
- Note title as the reminder title
- First 100 characters of the note's second line as reminder body
- Deep links back to the original note (desktop and mobile versions)
- Due date set to the coming Saturday at 10:00 AM
- Reminder placed in the "Default" list
-
Open Apple Notes Select the note you want to create a reminder for
-
Run the Script
Double-click the.applescriptfile or run via Script Editor -
Verification
- The selected note will open in a separate window
- The script will extract information and create a reminder
- Reminders app will open showing the newly created item
flowchart TD
A[Start Script] --> B[Get Selected Note]
B --> C[Extract Note Title & Content]
C --> D[Query NoteStore.sqlite Database]
D --> E[Generate Deep Links]
E --> F[Calculate Next Saturday]
F --> G[Create Reminder]
G --> H[Open Reminders App]
The script uses SQLite to query the NoteStore.sqlite database to retrieve the real UUID of the note, allowing for proper deep linking.
Warning
Make sure go to System Preferences > Security & Privacy > Full Disk Access for Script Editor and enable it.
-- Query the NoteStore.sqlite database to get the real note identifier (UUID)
set sqliteQuery to "SELECT ZIDENTIFIER FROM ZICCLOUDSYNCINGOBJECT WHERE Z_PK=" & internalPK & ";"
try
set realNoteID to do shell script "/usr/bin/sqlite3 ~/Library/Group\\ Containers/group.com.apple.notes/NoteStore.sqlite " & quoted form of sqliteQuery
on error errMsg number errNum
display dialog "Error retrieving note identifier: " & errMsg
return
end tryTwo deep links are created:
notes://showNote?identifier=UUID(Desktop)mobilenotes://showNote?identifier=UUID(iOS)
Automatically calculates the coming Saturday at 10:00 AM for the reminder due date.
- Requires macOS with access to both Notes and Reminders apps
- Needs permission to:
- Control Apple Notes
- Control Reminders
- Access your Notes database
- Will create reminders in the "Default" list (create this list if it doesn't exist)
- First-time use requires Automation permissions in System Preferences