AppleScript to copy Notes to designated folder

Discussion in 'Mac Programming' started by EmpyreanUK, Dec 4, 2013.

  1. EmpyreanUK macrumors regular

    Joined:
    Mar 6, 2011
    #1
    Hello,

    I'm a big fan of Ulysses 3 for managing my library of text documents, and find it so effective that I'd like to start using it for managing my notes, moving away from my current hodgepodge of the stock Notes.app and Evernote.

    However, I am also find Notes.app on iOS, and note creation using Siri, to be very effective input methods for when I'm on the go. And it's of course true that, the easier it is to input information, the more likely one is to actually do it (especially when juggling one's phone with an umbrella whilst walking to the train station).

    What would be ideal for me, then, is some kind of automation for copying the text of notes from Notes.app into RTF files in Ulysses' directory. I've thought of a few possible methods of doing this.

    The easiest would be to create a rule in Mail.app (Notes seems to use the IMAP protocol) for forwarding all messages in the Notes mailbox to IFTTT, which can then create RTF files in Dropbox for me. However, the Notes mailbox is hidden from Mail.app, meaning that I cannot easily create a rule, and the method Notes.app uses for managing documents over IMAP is opaque to me. My hunch is that messages are synced in .emlx format using IMAP, but are then stored in some kind of mishmash of HTML in a gigantic library file. I'm therefore not confident that this method would be reliable.

    I've since discovered that Notes.app supports AppleScript, so I am now wondering whether a less hacky approach would be to use this interface to copy note body text into an RTF file. However, I know nothing about AppleScript, and so I'd like to ask a couple of questions about this idea:

    1. Is it possible?
    2. Can such a script run in the background, so as to fully automate the process, or would it need to be initialised by myself every time I wish to copy notes across?
    3. Ulysses uses Markdown. Would it be possible to include the note title in the RTF document with the '#' markup tag denoting a header?
    4. Are there any resources available online that I could use to work out how to do this? The only scripting language I am proficient with is PHP, and I only know how to write code procedurally. Am I correct in assuming that AppleScript uses an OOP model?

    Many thanks for your time and any help, and apologies if I've posted this in the wrong forum.
     
  2. kryten2, Dec 4, 2013
    Last edited: Dec 4, 2013

    kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
  3. EmpyreanUK thread starter macrumors regular

    Joined:
    Mar 6, 2011
    #3

Share This Page