Skip to content

Instantly share code, notes, and snippets.

@derickfay
Last active August 8, 2017 19:30

Revisions

  1. derickfay revised this gist Sep 16, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion export text from el capitan notes.applescript
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,11 @@ set theDate to do shell script "date '+%Y-%m-%d'"
    set outputPath to "~/Dropbox/mytemp/"
    set format to "txt"
    set counter to 1
    set theFolder to "Notes"
    -- uses a counter to avoid duplicate filenames if notes have the same title

    tell application "Notes"
    tell folder "Notes"
    tell folder theFolder
    set theNotes to every note
    repeat with n in theNotes
    set t to body of n
  2. derickfay revised this gist Sep 16, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions export text from el capitan notes.applescript
    Original file line number Diff line number Diff line change
    @@ -2,6 +2,7 @@ set theDate to do shell script "date '+%Y-%m-%d'"
    set outputPath to "~/Dropbox/mytemp/"
    set format to "txt"
    set counter to 1
    -- uses a counter to avoid duplicate filenames if notes have the same title

    tell application "Notes"
    tell folder "Notes"
  3. derickfay renamed this gist Sep 16, 2015. 1 changed file with 0 additions and 0 deletions.
  4. derickfay created this gist Sep 16, 2015.
    15 changes: 15 additions & 0 deletions export text from el capitan notes.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    set theDate to do shell script "date '+%Y-%m-%d'"
    set outputPath to "~/Dropbox/mytemp/"
    set format to "txt"
    set counter to 1

    tell application "Notes"
    tell folder "Notes"
    set theNotes to every note
    repeat with n in theNotes
    set t to body of n
    do shell script "echo " & quoted form of t & "| textutil -format html -convert " & format & " -stdin -output " & outputPath & "/" & quoted form of ((name of n) as string) & "_" & counter & "_" & theDate & "." & format
    set counter to counter + 1
    end repeat
    end tell
    end tell