View Single Post
If you want to use the fancy "task @ Context > Project..." syntax, you can use this syntax:

Code:
tell application "OmniFocus" to tell document 1
	parse tasks with transport text "The Text"
end tell
The parse tasks will also do the Mail rule's trick of finding new tasks on every line prefixed with "--".

If you want the Bash script, you can do the following:

1. Create an AppleScript with the following code:

Code:
on run argv
  tell application "OmniFocus" to tell default document
    parse tasks with transport text argv
  end tell
end run
Then from the command line, you're looking for a command like:

Code:
$ osascript /path/to/thescript.scpt "Task @ Action > Project"
Writing that into a Bash script ought to be pretty straightforward.

Note that if you want to be able to send the command without enclosing quotes, you'll need to pass the arguments to the script as a single string, or have the script concatenate them.

It's also possible to enclose the whole thing in the shell script itself, using osascript -e "first line of script" -e "Second line of script" syntax, but that can get pretty painful, especially once you consider escaping characters for bash as well as for AppleScript. I much prefer the simple "pass this argument to the script" method. (Plus it can be as simple as an aliased command, rather than a bash script as well as the AppleScript)

Last edited by iNik; 2007-12-06 at 11:52 AM..