Having a bit of an issue with an AppleScript.
I’m adding a new task using the awesome parse tasks into with transport text
, and that seems to work pretty well (the advantage of this way is that a oneliner can have symbols indicate project, context, notes, etc). However, I also want the option of modifying that text’s note, for example to append something to it like a timestamp or additional text information.
I can get a regular task from the inbox and see its task id, note, name, etc., but if I added it using the parse tasks into
syntax, I get some kind of class FCit
error when I try to access the task properties.
For example:
tell application "OmniFocus"
tell default document
set new_task to parse tasks into with transport text task_name with as single task
-- compact -- doesn't seem to help
properties of new_task
end tell
end tell
Error:
error "Can’t get properties of {inbox task id \"hpHzInscrvS\" of document id \"monBivzr_ix\"}." number -1728 from properties of {«class FCit» id "hpHzInscrvS" of document id "monBivzr_ix"}
Any ideas?
Figured it out. parse tasks into
makes a “list” of tasks, even if you use as single task
.
Accessing the task as first item of new_task
works, e.g.
set task_name to "this is my example task"
tell application "OmniFocus"
tell default document
set new_task_list to parse tasks into with transport text task_name with as single task
set new_task to first item of new_task_list
properties of new_task
end tell
end tell```
Returns:
```{blocked:false, due date:missing value, defer date:missing value, containing project:missing value, completion date:missing value, creation date:date "Wednesday, June 25, 2014 at 10:27:36 PM", modification date:date "Wednesday, June 25, 2014 at 10:27:36 PM", id:"akSyLXo-s1_", completed:false, context:missing value, container:document id "ce0FksEYouq" of application "OmniFocus", number of tasks:0, completed by children:false, containing document:document id "ce0FCskYouq" of application "OmniFocus", class:inbox task, parent task:missing value, next:false, repetition:missing value, number of available tasks:0, estimated minutes:missing value, repetition rule:missing value, number of completed tasks:0, assigned container:missing value, in inbox:true, name:"this is my example task", sequential:false, flagged:false, note:""}```
2 Likes