New MacJournal entry – applescript

-- This handler creates an entry in a specific journal
-- p_journal: The journal in which the note should be created
-- p_title: The title of the note
-- p_text: The note body
-- p_taglist: A list of strings that are the tag names
-- p_date: Set the note date to this value

on createMacJournalEntry(p_journal, p_title, p_text, p_taglist, p_date)
    tell application "MacJournal"
        tell journal p_journal
            set newnote to make new journal entry with properties {name:p_title, plain text content:p_text, date:p_date}
            convert to richer text newnote
            repeat with tag_item in p_taglist
                add tag tag_item to newnote
            end repeat
        end tell
    end tell
end createMacJournalEntry

-- Example usage
createMacJournalEntry("TheJournalName", "TheNoteTitle", "TheNoteBodyt", {"tag1", "tag2"}, TheNoteDate)</pre>
blog comments powered by Disqus