The Omni Group Forums

The Omni Group Forums (
-   OmniFocus Extras (
-   -   Capturing selection with AppleScript (

MB_UST 2008-06-13 03:38 PM

Capturing selection with AppleScript
Hello everyone,

I apologize if this is a repeat question, but I've been looking at the forum, looking at the OmniFocus dictionary and searching the Internet for the answer, but have not gotten anywhere to resolve my problem. So perhaps someone here can kindly let me know whether and how one can capture a given selection (e.g., a selected task) with AppleScript. I would like to create a Script that once I have selected a project or a task, but especially a task, I can trigger a script.

If that is not possible with the current version of OmniFocus, is it possible to select a project ("focus") and then have a script retrieve information on that project alone? I'm thinking that perhaps "selected trees" is a way to get to it, but I can't get the syntax right.

Any help is much appreciated.


MB_UST 2008-06-14 06:26 AM

I figured it out, finally:
tell application "OmniFocus"
tell document 1
tell (first document window whose index is 1)
set SelectionV to selected trees of content
--Then you can parse the resulting variable (SelectionV) to get the data you want:
repeat with i from 1 to (count of SelectionV)
set ItemV to value of item i of SelectionV
end repeat
end tell
end tell
end tell

All times are GMT -8. The time now is 11:17 AM.

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