Querying Mori databases within Applescript

Tags ( )

Is it possible to execute a query in Mori using a set of entry attributes wholly within Applescript, without either 1) cycling through the entire list of entries by brute force or 2) setting up a smart folder to "contain" the query and then calling the fetched entries of that entry?

Thanks for any guidance.

Off the top of my head, you

Off the top of my head, you might be able to do this using AppleScript's Cocoa interface layer to send a message to the appropriate object inside Mori, but I'm not sure; just a guess. However, the amount of processing work you may have to do might not be worthwhile, i.e. just use a temporary smart folder, it's easier.

Thanks for the response.

Thanks for the response. BMEguy also suggested using "whose" in Applescript, which does pretty much exactly what I want for built-in data columns. Unfortunately, I haven't been able to figure out how to use it with user-defined data columns. The form is:

tell application "Mori"

  tell front document

    set upcomingTasks to every entry whose due date is greater than (current date)

    set greenTasks to every entry whose label is green label

  end tell

end tell

...and you can chain the conditions with and/or to query for multiple attributes.

I don't think you'll be able

I don't think you'll be able to use the whose clause for custom columns. I think your only option is to iterate over all entries in the notebook and test each value using the "value for key" command. Something like:

tell application "Mori"

tell front document
repeat with each in entries
// do test here
end repeat
end tell

end tell

Comment viewing options

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