Hello,

I am using Yojimbo a lot for creating and managing todos. This made me think of a super-fast way to add todos through quicksilver.

The script is at a very early stage but I wanted to get it on the list in the hope for some testers and helpful feedback. Be aware this is my first applescript---I am sure the code is ugly.


Sebastian


Description
===========

The idea is to enter a string into quicksilver using the "." command and then use this script as an action. It parses the string and file a note item with the given name and contents in Yojimbo. It assumes you have a label with the name "Todo" and applies the label. If you want to change the label you have to edit the script.

Additionally you can specify one or more collections or tags and you can flag an item if you want. Some examples for the syntax:


  Run errands

The easiest possible syntax. Just add the todo with the given title.


  Create user account >>Work +account -- username: glib

This creates a note with the title "Create user account", put it into the "Work" folder collection and assign the "account" tag. The contents is "username: glib"


  Order new backup tapes !! >>Work +backup +orders

This creates a note with the titel "Order new backup tapes", put it into the "Work" folder collections and assign the "backup" and "order" tags. It also flags the item. The contents is empty.

The order of the keywords (those starting with !!, >> or +) does not matter as long as they appear on the left side of " -- ", together with the title.


Installation
============

Paste the script into script editor and save it into ~/Library/ Application Support/Quicksilver/Actions/addYojimboTodo.scpt. Create the Actions folder if it does not exist. Restart quicksilver.


The script
==========

using terms from application "Quicksilver"
        on process text theString
                -- cut out content, if any
                set AppleScript's text item delimiters to " -- "
                try
                        set theItems to the text items of theString
                        set theName to item 1 of theItems
                        set theContents to item 2 of theItems
                on error
                        set theName to theString
                        set theContents to ""
                end try
                try
                        -- if there are spaces then split
                        set AppleScript's text item delimiters to " "
                        set theItems to the text items of theName
                        -- try to find collection, flag and tag specifiers
                        set theTitleWords to {}
                        set theCollections to {}
                        set theTags to {}
                        set theFlag to false
                        repeat with oneItem in theItems
                                if oneItem starts with ">>" then
                                        set AppleScript's text item delimiters to 
""
                                        set the end of theCollections to items 
3 thru -1 of oneItem as text
                                        set AppleScript's text item delimiters to " 
"
                                else if oneItem starts with "+" then
                                        set AppleScript's text item delimiters to 
""
                                        set the end of theTags to items 2 thru 
-1 of oneItem as text
                                        set AppleScript's text item delimiters to " 
"
                                else if oneItem starts with "!!" then
                                        set theFlag to true
                                else
                                        set the end of theTitleWords to oneItem 
as text
                                end if
                        end repeat
                        set AppleScript's text item delimiters to " "
                        set theTitle to theTitleWords as text
                on error
                        -- no spaces or parse error. use a one-word title
                        set theTitle to theName
                end try
                -- restore default value
                set AppleScript's text item delimiters to ""
                set theTitleText to theTitle
                tell application "Yojimbo"
set theNote to make new note item with properties {name:theTitleText, contents:theContents, label name:"Todo", flagged:theFlag}
                        add tags theTags to theNote
                        repeat with oneCollection in theCollections
                                add theNote to folder collection named 
oneCollection
                        end repeat
                end tell
        end process text
end using terms from

--
------------------------------------------------------------------
This message is sent to you because you are subscribed to
 the mailing list <[email protected]>.
To unsubscribe, send mail to: <[EMAIL PROTECTED]>
List archives:  <http://www.listsearch.com/yojimbotalk.lasso>
Have a feature request, or not sure if the software's working correctly? Please send mail to: <[EMAIL PROTECTED]>

Reply via email to