Mori Sample Scripts

Tags ( | )

A collection of sample scripts to get AppleScripters started with Mori. Including a bunch of basic scripts showing how to access and manipulate entries, and a number of more complicated scripts that might actually be useful. Including scripts to assemble entries, export entry to ipod, get current page from safari, and import current mail message.

Update: As of Mori 1.4 the Mori Sample Scripts collection comes on the Mori disk image (DMG) file when you download Mori. Use those scripts for the latest versions.

Version: 1.4

Handling text attributes with applescript...

Leaving this as a note to myself for the next that that I update the Sample Scripts collection. Here's a way to copy the contents of one entry note into another entry note that will also copy over text attributes:

tell application "Mori"
tell front document
set a to entry named "a"
set b to entry named "b"

set t to a reference to note of a
set note of b to t
end tell
end tell

Appending to a note

Straight copying like this may work, but I need to append one note to another and for that I'm not sure how to replicate this technique. I tried the following but it didn't work:


tell application "Mori"
tell front document
set a to first item of selection
set b to second item of selection
set a's note to (a reference to a's) note & (a reference to b's note)
end tell
end tell

But this has the same effect as writing set a's note to a's note & b's note, i.e. the text attributes get clobbered. Any suggestions?

(P.S. Jesse, can you allow tags in posts so that it's easier to display code?)

Modified Basic Scripts

I've made some modifications to the basic scripts that you might want to incorporate. I've changed some of them on my computer to make them return feedback (so they are actually useful for something other than examples of how to write Mori scripts). For example:


tell application "Mori"
count every entry of front document
display alert result
end tell

So I end up with a little dialog telling me how many entries are in my document (a count I can't seem to find anywhere in the application).

If you send me your

If you send me your modifications I'd be happy to include them in the sample scripts collection. I agree it would be a great improvement if they were a bit more on the useful side instead of just code examples.

What additional HTML tags do you need? I'm not sure how easy a change is, right now my options are either the current tag filters, or turning on full HTML support... something that I'm hesitant to do. Typing HTML in general isn't very nice in my mind, but so far I haven't found a good javascript post editor that works with drupal and will work in safari.

Oops. Actually, I typed

Oops. Actually, I typed what tag would help, but then I was a little too literal and it got swallowed by the browser. What I was trying to say is that pre tags would help, since that would make typing code examples easier (spaces and such would render, whereas inside code blocks they don't).

The Export to iPod is still not right

I still have problems with the most recent version of the Export to iPod script. It works only when launch directly (in Script Editor) but not in Mori 1.4 (nothing happens then).

In addition, the export is only made if I choose to put the new note into the Notes folder, but not in its sub-folders.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.