The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   How can I enter text into the Note field of existing item with AS? (http://forums.omnigroup.com/showthread.php?t=8697)

MB_UST 2008-07-14 07:18 PM

How can I enter text into the Note field of existing item with AS?
 
Hello,

Here's what I hope is a simple question for someone:

How can I enter text into the note field of selected action item with AppleScript? I'm thinking of something along the lines of:
set note of itemX to "Some Text"

I can easily do it with a parsing command for an item I am creating, but I don't see in the dictionary how to do so for an already existing item, and multiple attempts have yielded nothing useful. I would like to know how to do it for a selected item, and if the syntax is different for a non-selected item, then for that as well. I can't imagine that the answer should be very complicated, so I hope someone can take a minute to answer me.

Thanks a lot.

MB

whpalmer4 2008-07-14 11:21 PM

Well, you've actually got exactly the statement you need to do what you want. The tricky part is getting your hands on the selected item!

Here's a sample script that will append a string to the notes field of the selected items. Note that it does not drill down into contained items.

[CODE]
tell application "OmniFocus"
tell front document
tell (first document window whose index is 1)
set theSelectedItems to selected trees of content
end tell
repeat with i from 1 to count of theSelectedItems
set selectedItem to value of item i of theSelectedItems
set theName to name of selectedItem
set theNote to note of selectedItem
set theNote to theNote & "
This is a note inserted in " & theName
set note of selectedItem to theNote
end repeat
end tell
end tell

[/CODE]

MB_UST 2008-07-15 11:04 AM

Thanks a million!


All times are GMT -8. The time now is 01:16 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.