Quicksilver to Mori

Here’s one way to use Quicksilver to enter information into Mori. This is all taken from Leo’s post, I’ve just added some screenshots to help people out.

  • Get and install Quicksilver
  • Install Text Manipulation Actions plugin by going into Quicksilver’s Plug-ins preferences panel and checking the Text Manipulation Actions plugin.

Quicksilver's Plug-ins panel

  • Add the following Applescript program to ~/Library/Application Support/Quicksilver/Actions/ with the name “in.scpt” (you will probably need to create the Actions folder)
using terms from application "Quicksilver"
    on process text theText
        tell application "Mori"
            tell front document
                set inFolder to entry named "Inbox"
                make new entry at end of entries of inFolder with properties {name:theText}
            end tell
        end tell
    end process text
end using terms from
  • Next restart Quicksilver so it can discover your changes.
  • Now invoke Quicksilver by typing Control-Space. Type ‘in’ to find your script, hit Tab twice, enter your text, and hit the Return key when you are done. The text that you entered has now been added to Mori’s inbox.

Quicksilver to Mori

  • You can modify the above script to include the contents of the clipboard by adding these lines.
set clipboardText to the clipboard as text
make new entry at end of entries of inFolder with properties {name:theText, note:clipboardText}

Acting on text in Quicksilver

Another way to add text in Quicksilver is to invoke Quicksilver then hit "." (period) to put it into text mode. You can then enter any text you want, or paste the clipboard. Once you're done, tab to the Actions pane, type the first letter or two of your Applescript and hit enter. (This is the method Merlin Mann documents on 43folders.com).

it's the same number of keystrokes as Jesse's example, but I find it faster since Quicksilver only has to search the Actions folder instead of the entire drive for your Applescript.

I haven't figured out how to enumerate Mori folders in Quicksilver, but you can easily create several scripts, each of which stick the text into a different Mor folder.

--
Leo Laporte
Chief TWiT

Tryin’ it...

Yeah, that works a treat. Ta.

Useful!

This is amazingly useful. I've created a modified version that places the typed text into the body of the note and uses the first 60 characters for the title:

using terms from application "Quicksilver"
on process text theText
tell application "Mori"
tell front document
set inFolder to entry named "Inbox"
set theTitle to ((characters 1 thru 60 of theText) as string)
make new entry at end of entries of inFolder with properties {name:theTitle, note:theText}
end tell
end tell
end process text
end using terms from

What I'd like is to have the ability to define the title by using some code at the end of the title text. For instance, to write:

This is the title||This is the body of the note.

Or something of the sort.

here it is

This version will break the note at the first "||", or whatever characters you set in the line marked below. Also I added a check for whether or not there is an "Inbox" and it makes one if there isn't.


using terms from application "Quicksilver"
on process text theText
tell application "Mori"
tell front document

--make sure there's an inbox to receive the new entry
if exists entry named "Inbox" of root entry then
set inFolder to entry named "Inbox" of root entry
else
set inFolder to (make new entry with properties {name:"Inbox", content type:"public.folder"})
end if

--breaks the entry into two.
set saveDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"||"} --change this string to change which characters separate the title and note. If you leave it out the note will be empty, and everything you type will go into the title. If you start your typing with these characters, you're entry will be untitled, and everything will go into the body of the note.
set theList to every text item of theText
set AppleScript's text item delimiters to saveDelim
try
set theTitle to item 1 of theList
set theText to item 2 of theList --erase this line if you want the title to be included in the body of the note as well
end try

make new entry at end of entries of inFolder with properties {name:theTitle, note:theText}
end tell
end tell
end process text
end using terms from

Script needs tweaking?

Your script is very useful but it seems there's been a change in Mori causing the script not to compile. It fails at this line:

set inFolder to (make new entry with properties {name:"Inbox", content type:"public.folder"})

I changed "content type" to "content" and it worked, but instead of creating a folder it made a document and put the new note into that.

The script works fine if there is an existing folder called "Inbox".

"content type" has become

"content type" has become "kind". If you change that then I think it should work OK.

Tweaked script

Here's my version of the script. This one breaks title vs contents based on the first newline in the text - you can insert a newline in Quicksilver's text entry by hitting option-return. It also adopts the Inbox check of the previous posted revised script.


using terms from application "Quicksilver"
    on process text theText
        set delims to AppleScript's text item delimiters
        set AppleScript's text item delimiters to ASCII character 10
        set theLines to every text item of theText
        set AppleScript's text item delimiters to delims
        set theTitle to first item of theLines
        set theBody to ""
        repeat with i from 2 to count of theLines
            set theBody to theBody & item i of theLines & return
        end repeat
        tell application "Mori"
            tell front document
                if exists entry named "Inbox" then
                    set inFolder to entry named "Inbox"
                else
                    set inFolder to (make new entry with properties {name:"Inbox", kind:"public.folder"})
                end if
                make new entry at end of entries of inFolder with properties {name:theTitle, note:theBody}
            end tell
        end tell
    end process text
end using terms from

--
And remember, no matter where you go, there you are.
-Buckaroo Banzai

Mmm...

This isn't working for me unfortunately; here's what I do:
- I bring up quicksilver
- Search for in.scpt (which is in the actions folder in quicksilver app support) which contains this applescript:

using terms from application "Quicksilver"
on process text theText
tell application "Mori"
tell front document
set inFolder to entry named "Inbox"
make new entry at end of entries of inFolder with properties {name:theText}
end tell
end tell
end process text
end using terms from

- Then I press tab twice as suggested and a third box doesn't appear, it just switches between the two boxes (there's no 'process text' box at all.)

I then tried Leo's method, but that didn't work either, I entered text in the first box, then tabbed to the next, selected in.scpt, and pressed enter, nothing happens in mori....

Any help would be much appreciated, thanks.

Quicksilver - Service Menu Module

You can also use the "Service Menu Module" plugin to completely avoid AppleScript (picture).

works perfectly... but is there a way to add column info?

The Service Menu Module plugin works great -- adding a new entry is just invoke Quicksilver, type the title, hit return.

Is there a way to automatically assign a due date to these entries? Or any other column selections?

Putting a colour label to note from Quicksilver into Mori Folder

Simon NZ

Building on what has gone before - thanks very much guys (esp.Kevin)- and ....
After much messing about, this works for me. I have several scripts to push the note into several different folders and assign colours to them. Then I can use a Smart Folder to pull all RED notes from all folders - RED being ( for me ) "Requires your urgent attention".

This script is called PersonalRED.scpt for me in my QS Actions Folder.

using terms from application "QuickSilver"
on process text theText
set delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ASCII character 10
set theLines to every text item of theText
set AppleScript's text item delimiters to delims
set theTitle to first item of theLines
set theBody to ""
repeat with i from 2 to count of theLines
set theBody to theBody & item i of theLines & return
end repeat
tell application "Mori"
tell front document
set inFolder to entry named "Personal"
make new entry at end of entries of inFolder with properties {name:theTitle, note:theText}
tell entry named theTitle
set label to red label
end tell
end tell
end tell
end process text
end using terms from

SideNote : I noticed QS was taking up a lot of resources and tried to live without it. Now I have QS back (after 2 days of pain!) and have closed Mail(work) and Entourage(personal) and only open Mail and Ent a couple of times per day to read email rather than having them constantly running and interrupting. I get more done now with QS and without Mail and Ent.

adding column info

Finally came back around to this and got it working by adding a little bit to what others have posted. I'm still using Mori as a to-do list on steroids, and now I can use Quicksilver to create a new item in Mori with today's date as the due date already entered. This is key for me because the new entry immediately shows up in my Today's Next Actions smart folder.

using terms from application "Quicksilver"
on process text theText
set theDate to (current date)
tell application "Mori"
tell front document
set inFolder to entry named "Inbox"
make new entry at end of entries of inFolder with properties {name:theText}
tell entry named theText
set due date to theDate
end tell
end tell
end tell
end process text
end using terms from

"tell entry named..." affects first instance with that name

Howdy, I'm trying to get QS to throw together title, text, and tags in one shot, but if I use a title I've used before, the new tags get appended to the first instance with that title. Does anyone know a way to get the ID of the most recent addition (preferably without iterating over all entries)? Here's what I've got thus far (thanks to above scripters from whom I have stolen):


using terms from application "Quicksilver"
  on process text theText
    set delims to AppleScript's text item delimiters
    set AppleScript's text item delimiters to {";;"}
    set theLines to every text item of theText
    set theTitle to first item of theLines
    set theBody to second item of theLines
    set theRest to third item of theLines
    set AppleScript's text item delimiters to {","}
    set theTags to every text item of theRest
    set AppleScript's text item delimiters to delims
    tell application "Mori"
      tell front document
        set inFolder to entry named "Inbox"
        make new entry at end of entries of inFolder with properties {name:theTitle, note:theBody}
        repeat with aTag in theTags
          add entry named theTitle tag aTag
        end repeat
      end tell
    end tell
  end process text
end using terms from

This tokens sections on ";;" and tags on ','. Maybe someday I'll parse for "#due" or something to really get out of hand, but for now I'd like my tags in the right place. Thanks!

(ps Why don't the freaking code tags work in this forum?)

EDIT:
Okay, so I used the following to check if the title already exists and generate and test numbered alternatives.

repeat while exists entry named theTitle
  set theTitle to titleRoot & " " & (counter)
  set counter to counter + 1
end repeat

So this new tack raises a different question: can you check the entry to see if it's in the Trash? As it is, an existing entry in the trash is caught by the above, and I would rather it wasn't. I think it would make use of a statement like
if entry container is equal to "Trash" then exit repeat
but I've never actually used AppleScript before today.

Updated Version

The quietude in here makes me worry that I'm missing out on an existing solution. That aside, here's my latest revision with options for tags and a due date. I also renamed the script "send to mori.scpt" because "in.scpt" was obscure without any advantage.

--Quicksilver to Mori entry Applescript
--Format:
--    [title];;[body[;;[tag[,tag[,...]][;;[date]]]]]
--  Examples:
--        Bookstore;;Buy a book on Applescript
--        Bookstore;;Buy a book on Applescript;;todo,programming
--        Bookstore;;Buy a book on Applescript;;todo,programming;;7/15/09
--        Bookstore;;Buy a book on Applescript;;;;7/15/09

using terms from application "Quicksilver"
    on process text theText
        set counter to 1
        set delims to AppleScript's text item delimiters
        set AppleScript's text item delimiters to {";;"}
        set theLines to every text item of theText
        set titleRoot to first item of theLines
        set theTitle to titleRoot
        set theBody to second item of theLines
        try
            set theTags to third item of theLines
        on error
            set theTags to ""
        end try
        try
            set theDueDate to fourth item of theLines
            set theDueDateAsDate to date theDueDate
        on error what
            set theDueDate to ""
        end try
        set AppleScript's text item delimiters to delims
        tell application "Mori"
            tell front document
                repeat while exists entry named theTitle
                    set theTitle to titleRoot & " " & (counter)
                    set counter to counter + 1
                end repeat
                set inFolder to entry named "Inbox"
                if theDueDate is equal to "" then
                    set theProperties to {name:theTitle, note:theBody}
                else
                    set theProperties to {name:theTitle, note:theBody, due date:theDueDateAsDate}
                end if
                make new entry at end of entries of inFolder with properties theProperties
                if theTags is not equal to "" then
                    set AppleScript's text item delimiters to {","}
                    set theTagsList to every text item of theTags
                    repeat with aTag in theTagsList
                        add entry named theTitle tag aTag
                    end repeat
                end if
            end tell
        end tell
    end process text
end using terms from

Comment viewing options

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