Export From the Notes App Using a Script

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 ก.ย. 2024
  • macmost.com/e-... In Mac Notes you can only export one note at a time as a PDF file. With the help of a script, you can quickly and easily export all of your notes to html files as a backup or archive. You can also save notes this way to clear out your Notes app.
    FOLLOW MACMOST FOR NEW TUTORIALS EVERY DAY
    ▶︎ TH-cam - macmost.com/j-y... (And hit the 🔔)
    ▶︎ Weekly Email Newsletter - macmost.com/ne... ✉️
    ▶︎ Twitter - / rosenz and / macmost 🐦
    ▶︎ Facebook - / macmost 👍
    SUPPORT MACMOST AT PATREON
    ▶︎ macmost.com/pa... ❤️
    #macmost #notes #javascript

ความคิดเห็น • 94

  • @mynameiswool
    @mynameiswool 3 ปีที่แล้ว +7

    This video was extremely helpful! Thank you!
    I used the following code to add the creation date of the note as the first line of the HTML file before the body of the note.
    app.write(notes[i].creationDate().toString(), {to: file});
    app.write(notes[i].body(), {to: file});
    I'm sure folks could do something similar to put the creation date in the file name.

  • @guerreronikelaos2838
    @guerreronikelaos2838 3 ปีที่แล้ว +1

    This video should be on top when I search from "exporting notes on mac". You are brillant, thank you so much, theres no other tutorial in youtube like this I believe.

  • @joewest9470
    @joewest9470 2 ปีที่แล้ว +1

    This is awesome. I made a couple of simple modifications to not ask the user anything, and this script gets called in the background every once in a while from my launch daemon, and all notes are backed up to a particular folder in dropbox regularly without any interruption/action from me. Since I also use time machine, this means that I can easily go back in time to see versions of every note without being restricted by the free dropbox account time limits or whatever. Thank you for doing this!

    • @dennisdahl3
      @dennisdahl3 ปีที่แล้ว

      can you share your script please?

  • @chrisbarnett1985
    @chrisbarnett1985 4 ปีที่แล้ว +3

    Thanks for the video. Would like to see more of these scripting tutorials for Mac apps

  • @aravinth007vt
    @aravinth007vt ปีที่แล้ว

    Ho my! This is gold. Thank you for the effort to explain so elaborately.

  • @TylerThomas
    @TylerThomas 2 ปีที่แล้ว

    Thank you man! I opened my notes after updating the latest round and ALL of them were gone. I finally found a local-only copy on my Mac and wanted to export to get out of Apple's WACK notes app. Worked like a charm on M1.

  • @vivianra9789
    @vivianra9789 4 ปีที่แล้ว +4

    Hi! Thanks for this, been searching for a way to do this to my 3,000+ notes for years! Wondering if there is a way the code can be tweaked to also export date & time data for each file?

    • @Refiningforge
      @Refiningforge 3 ปีที่แล้ว

      I want to know this too -- have you found anything that can do this?

  • @nellyrosa2680
    @nellyrosa2680 4 ปีที่แล้ว +3

    This is GREAT. Thank you for sharing.

  • @zurvey
    @zurvey 4 ปีที่แล้ว +7

    How sad that this is even necessary; it should be a basic feature of Apple Notes to export a batch of notes to PDF, text, or HTML. Thanks for this.

    • @quicksite
      @quicksite 3 ปีที่แล้ว

      AFAI'm concerned this is another of Apple's strategic measures to lock you into their ecosystem by specifically denying you any means to move your data to another platform, for instance to Simplenote, which is fully cross platform. I'm the peculiar variant of Macs + Android phone, so I can never have the Mac-to-iOS seamless experience. It's kind of predatory but I certainly get it, how Apple protects its value proposition by maintaining its walled garden.

  • @ubtean222
    @ubtean222 4 ปีที่แล้ว +2

    @macmostvideo I'm getting an error saying the following:
    Script Error:
    Error on line 26: Error: File wasn't found.
    Please help. Thank you.

  • @linkexv
    @linkexv 4 ปีที่แล้ว +1

    A+ explanation, thank you.

  • @JaimeHuffman
    @JaimeHuffman 4 ปีที่แล้ว +1

    Gary, Thank you for videos! You are so much help during this difficult time. Can you tell me the best way to send a fax on a Mac or any Apple device? I don’t have a landline. I appreciate your help.

    • @macmost
      @macmost  4 ปีที่แล้ว +1

      Use the site faxzero.com

  • @paulgoh2352
    @paulgoh2352 3 ปีที่แล้ว

    This is very cool, Thank you!! btw, can the script save each note into .pdf?

  • @Budge1970
    @Budge1970 4 ปีที่แล้ว

    THANK YOU THANK YOU. You are The Macfather :)

  • @JaimeHuffman
    @JaimeHuffman ปีที่แล้ว

    Gary, This is great. Are there any updates to this with Ventura? I saw that your drawings came through. Will this include all attachments and links as well? Appreciate all you do. You are truly an encyclopedia of useful Mac / Apple information. Have a great weekend!

    • @macmost
      @macmost  ปีที่แล้ว

      Today I would just use the Export as PDF function in Notes to do this. Only if you need to bulk export maybe as a backup would I do something like this.

  • @cnielson01
    @cnielson01 2 ปีที่แล้ว

    I have got in the habit of using the convenience of accessing Notes App availability on lower right corner of my iPad. It is handy if I have a topic I often think about I can open the app and create a note which could be a few sentences or it could be several pages. It’s handy as I can gather them all in a folder.
    Well, I have been doing this on a specific topic that I now want to bring into a document to fine tune them and send to a professional to review the content.
    Is copying one at a time the only way for my purposes, meaning to turn some of them into a document like a google doc or I considered a pages document. Something where I can send them where they look good to read.
    Maybe I should be not using notes for that purpose.
    I would welcome any thoughts on how to capture my thoughts as described and then later take some of those and create perhaps one typical document.
    Charlie

  • @prosperwithmel1832
    @prosperwithmel1832 4 ปีที่แล้ว

    Thank you! Thank you! Thank you!!!!

  • @user-zg2gx7gy5h
    @user-zg2gx7gy5h ปีที่แล้ว

    Thanks! this is just what I'm looking for. Why not open a github repo or organization.

  • @cboyda
    @cboyda 2 ปีที่แล้ว +2

    You can automatically make the names safe filenames with more code:
    var notename = notes[i].name();
    var safefilename = notename.replace(/[^a-z0-9]/gi, '_').toLowerCase();
    var filename = saveWhere+"/"+safefilename+".html";

  • @GargamelCZ
    @GargamelCZ 2 ปีที่แล้ว

    Thank you.

  • @waltersolon7015
    @waltersolon7015 3 ปีที่แล้ว +1

    Thanks a lot for this! Is there any way to keep the folder organization of the Notes app? I.e., to export all notes from each folder into separate new folders containing the htmls?

    • @macmost
      @macmost  3 ปีที่แล้ว

      Perhaps with a lot more work. I don't know if you have any coding experience so it could be difficult.

    • @waltersolon7015
      @waltersolon7015 3 ปีที่แล้ว +1

      @@macmost Thanks a lot for the prompt reply. I have no coding experience... Unfortunately...

  • @olexanderrudnev557
    @olexanderrudnev557 4 ปีที่แล้ว +6

    Very useful! Could you share your script, please 🙏

    • @macmost
      @macmost  4 ปีที่แล้ว +3

      It is on this post at the site. macmost.com/export-all-of-the-notes-on-your-mac-using-a-script.html

    • @ajimenez251
      @ajimenez251 4 ปีที่แล้ว +1

      @@macmost Looks like that code has some missing lines.... got error. Copied the differences by viewing the video.. but then got a "Error -10000: AppleEvent handler failed."

    • @macmost
      @macmost  4 ปีที่แล้ว +1

      @@ajimenez251 It works, exactly as-is. Are you sure you are using JavaScript, not AppleScript? Do you have any Notes with odd characters in the titles?

    • @ajimenez251
      @ajimenez251 4 ปีที่แล้ว

      @@macmost I did choose JavaScript. I cut and pasted the code from the site and the for loop line was missing part of the code: "for(var i=0; i -1) {" instead of "for(var i=0; i

    • @macmost
      @macmost  4 ปีที่แล้ว

      @@ajimenez251 I fixed that. Web browsers were treating the < like html code. Copy and paste should work now. In fact I just tried it (new document in Script Editor, copy and pasted right from the page). When you run it in Script Editor does it give you any more information, like a line number or more details.

  • @timberanek4062
    @timberanek4062 ปีที่แล้ว

    Hello Gary, I am trying to automate this process and I used much of the same code but instead of choosing a folder, I set a predetermined folder and required the program to pull all files from notes. However, I keep getting an error message that the folder is not found although I copied the path and pasted it. Any tips?

  • @akosgabriel5762
    @akosgabriel5762 2 ปีที่แล้ว

    Very helpful video, thank you! How would you save notes organized in folders?

    • @macmost
      @macmost  2 ปีที่แล้ว

      Not sure if there is a good way. Experiment and see what you can do.

  • @create1631
    @create1631 4 ปีที่แล้ว +1

    Tried it and it didn't work. I changed to Javascript and ran it. It gave the message: Error: Error: AppleEvent handler failed.

  • @morkovska
    @morkovska 2 ปีที่แล้ว

    Thank you so much for sharing this wonderful method. I only cannot make it out how to cope with notes in Russian: they convert as ????? (text inside the note is all question marks). Even if I paste them into decoders it doesn't help. Maybe someone knows how to fix the encoding?

  • @zlt1110
    @zlt1110 3 ปีที่แล้ว

    It always ends with undefined, I am wondering if that is normal. Also, how do you export picture, since I have several scanned documents I would like to export. THANK you!!

  • @erkie1641
    @erkie1641 2 ปีที่แล้ว

    legendary !!! wow.

  • @masochea5372
    @masochea5372 3 ปีที่แล้ว

    sorry why it say error The document “exporter note.scpt” could not be saved. (Error -1,752)

  • @user-gj3kv5hy2l
    @user-gj3kv5hy2l 4 ปีที่แล้ว

    Hi Gary!
    Thank you very much for this great video. I have two questions if it's OK:
    1. I have notes in Hebrew and it changes the Hebrew characters to ?, is there a way to handle it?
    2. I’m familiar with programing but not with javascript, if I want that the date of creation would be added to the exported note, where and how should I add the line “creationDate”?
    Thanks a lot!

  • @Bkkriversidelifestyle
    @Bkkriversidelifestyle 2 ปีที่แล้ว

    WHAT A NIGHTMARE!! WHO THE HELL HAS TO DO ALL THIS WORK WITHOUT ANY MISTAKE?

    • @macmost
      @macmost  2 ปีที่แล้ว

      Using a script like this isn't for everyone. Note that in the current version of macOS you can just use File, Export as PDF.

  • @accentontheoff
    @accentontheoff 2 ปีที่แล้ว

    Hi there, is this valid as of today on Monterey, and the upcoming Ventura. Thanks.

    • @macmost
      @macmost  2 ปีที่แล้ว +1

      Should be usable, but at some point since I made this video you can now just export as a PDF from the File menu. Use that instead.

    • @accentontheoff
      @accentontheoff 2 ปีที่แล้ว

      @@macmost Can’t do multiple files with that though. Need to regularly back up.

  • @TJ-22
    @TJ-22 10 หลายเดือนก่อน

    Hi Gary. It’s been 3 years since you posted this video. Is it currently possible to easily export data from either the Notes app or the Reminders app to a third-party app? Thank you.

    • @macmost
      @macmost  10 หลายเดือนก่อน

      From Notes today you can now simply export as PDF or to Pages. From Reminders, not sure what you are looking for, but you can print to PDF or copy and paste. Exporting from Reminders doesn't make sense in the same way though.

    • @TJ-22
      @TJ-22 10 หลายเดือนก่อน

      @@macmost Thanks. Apparently I have outgrown the Reminders app. It is recommended that you do not exceed 1 GB of data in the reminders app. I have already far exceeded that. I use it quite often for work and personal use. Therefore, I am considering exporting its data to a reminder app that can handle more data. But the app needs to be one that allows attached images. I would prefer it to be one that’s compatible with Siri as well.

    • @JayGalvin8888
      @JayGalvin8888 7 หลายเดือนก่อน

      I’m missing something. Is there a way to export 1,900 notes to individual pdfs?
      Thanks

  • @lorensims4846
    @lorensims4846 3 ปีที่แล้ว +1

    "…more modern programming language…"
    You realize, don't you, that AppleScript AND JavaScript were BOTH inspired by the HyperTalk language in the HyperCard application to assign custom actions to buttons and page changes.
    JavaScript is in no way "more modern," it just looks more like a typical programming language than AppleScript does.

    • @NicholasDunbar
      @NicholasDunbar 2 ปีที่แล้ว

      indeed. Though E6 is not the same as JS was in those days. I think he just means it is more commonly used and apple didn't support it for automator tasks until recently?

  • @snakejuce
    @snakejuce ปีที่แล้ว

    Can you do this with any app that uses an .sqlite database? For example the application Sidenotes holds the notes in an .sqlite databse. How do we export those bad boys?
    The dev of the app told me that it's doable but did not give me any instructions on how to do so lol.

  • @seanberlin
    @seanberlin 3 ปีที่แล้ว

    Exported the text of my notes nicely, but didn't export any of the video attachments unfortunately. Is that possible?

    • @macmost
      @macmost  3 ปีที่แล้ว

      The current version of Notes has an export as PDF. Try that.

  • @daala6698
    @daala6698 2 ปีที่แล้ว

    Gary: 2022, June. I want to use your script but all the notes start with an image-character. I used a paid pdf-to-word web program and some funny set of chars appears in the filename (on Ubuntu) and the chars look fine in the Word doc. I dont know if one could scrip that out of the mac though. Just want to tell you that the CHARS are not a problem.
    Taking each file individually out of Note and (the enormous difficulty) of keeping track of which files have been exported and which have not -- This is a challenge.
    iOS 15 has made improvements in NOTES that made it possible to move SET OF FILES to a new folder in NOTES. there are say 9000 files so I will do that to make keeping track of hundreds of notes files a bit more reliable.
    I looked for an email to you in the macmost site but didnt see any authors attribution for the article even.
    It would be swell to do this with a script. Hey I was willing to be a javascript novice for this problem. Cant be that different from any other language and I do have a friend to check for details.
    -- email for you?

  • @lifeyourlifetoday
    @lifeyourlifetoday 2 ปีที่แล้ว

    Gary, I'm getting 2 errors from the code I copy & pasted I hope this is ok, but I'm not able to move forward, Error on line 9: Error: List is empty and Error -50: Parameter error I working on MAC. I take it this works even if they are in the trash folder, but not that long a few days.

    • @macmost
      @macmost  2 ปีที่แล้ว

      Probably something to do with the name of your note or something else about it. The trash may have something to do with it. Try different things. Also, note that today (2022) you can simply use File, Export as PDF.

  • @Magnificent1393
    @Magnificent1393 3 ปีที่แล้ว

    Thank you, if I find the notes location and copy all of it including the attachments, can I return it all by pasting them back to my original mac folder?

    • @macmost
      @macmost  3 ปีที่แล้ว

      Doubtful it would be that easy. But try it and see.

    • @Magnificent1393
      @Magnificent1393 3 ปีที่แล้ว

      @@macmost Will do! Can you make a code to export all of the notes as multi pdf? Not just one by one?
      Thanks again

    • @macmost
      @macmost  3 ปีที่แล้ว

      @@Magnificent1393 Not sure. It would take a lot more work.

  • @dennisdahl3
    @dennisdahl3 ปีที่แล้ว

    OSX10.13.3 I have over 4000 notes. I want to export them all to individual PDFs. The loop would be: select note > Export as PDF > click Save. Select the next note down. Repeat.

    • @macmost
      @macmost  ปีที่แล้ว

      Sorry, thought I already responded to this. No way to do it in bulk other than select them all and export as a single big pdf. Why do you have 4000 notes?

    • @dennisdahl3
      @dennisdahl3 ปีที่แล้ว

      @@macmost Apple only allows a single note at a time to be exported as a PDF. I have 4000+ from saving every password to everything, including Newton, from 1993.

  • @AlergicToSnow
    @AlergicToSnow 4 ปีที่แล้ว

    Is there a way to use this mail? I want to create a pdf for each of my flagged or tagged mails, then delete them.

    • @macmost
      @macmost  4 ปีที่แล้ว

      You don't need a script for that. Just select all of the email messages you want to export, and choose File, Export as PDF.

  • @GoalDenDarceyHall
    @GoalDenDarceyHall 3 ปีที่แล้ว

    @macmostvideo How do we export with date/time created at start of file name so the files are easily sortable. (I have hundreds or thousands of notes, because, well, they're notes! I never thought to title them.... I've used notes like long post it notes & I've never titled a post it note. :D

    • @macmost
      @macmost  3 ปีที่แล้ว

      Not sure if it is possible, but look through the documentation in Script Editor and see what properties you can grab to use for a different file name with the date or time.

  • @Elise_Guitars
    @Elise_Guitars 2 ปีที่แล้ว

    Is there a way to export attachments as well?

    • @macmost
      @macmost  2 ปีที่แล้ว +1

      Not using a script. You can just drag-and-drop if you need to export an attachment.

  • @RupertFear
    @RupertFear 8 หลายเดือนก่อน

    How can I modify to export to pdf? Thanks in advance!

    • @macmost
      @macmost  8 หลายเดือนก่อน

      In the current version of the Notes app that is just a regular option in the File menu. No need for a script at all.

    • @JayGalvin8888
      @JayGalvin8888 7 หลายเดือนก่อน

      Your Java script exports all notes. The Export as pdf only exports the first selected note, even if all notes are selected.

    • @macmost
      @macmost  7 หลายเดือนก่อน

      @@JayGalvin8888 Yes, only one at a time. There is no way to export as a PDF using JavaScript.

  • @christ3010
    @christ3010 4 ปีที่แล้ว

    Hello. Thanks for script, good job ! How to export notes on UTF8 mode ? It's for special caracters (é, è, ...).

    • @macmost
      @macmost  4 ปีที่แล้ว

      Not sure if you can. Play around with it. And remember you can always use the Export function in Notes to save as a PDF too.

    • @christ3010
      @christ3010 4 ปีที่แล้ว

      macmostvideo 300 notes to export 😆

  • @stehlealexander
    @stehlealexander 4 ปีที่แล้ว

    Export should be possible as an .note !!!!!!!!!!!!!!!!!!!!!!! => Finder is ideal to halt EVERYTHING

  • @quicksite
    @quicksite 3 ปีที่แล้ว

    Thanks Gary, I followed along the presentation but in terms of replicating it, it's pretty much beyond my pay grade. I just don't have that expertise. My objective is to export Apple Notes, and then be able to import that file into Simplenotes.
    Reason? I use Android phones and there's no Apple Notes client for Android. (Yes I can SEE my notes via icloud.com, but I can't create notes using Android and have them show up on my Mac in the Mac-to-iphone seamless way.)

  • @roger9000
    @roger9000 2 ปีที่แล้ว

    Hi Gary, Great video ! I copied the code and added the "var notes = notesApp.accounts.byName('iCloud').notes;" for my emojies... Unfortunately I'm getting this message Error -1700: Can't convert types. Do you know what I'm doing wrong here ? Thanks !

    • @macmost
      @macmost  2 ปีที่แล้ว +1

      Hard to say. You've got to debug it and try things.

    • @roger9000
      @roger9000 2 ปีที่แล้ว

      @@macmost thanks Gary :)