The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Applescript: obtain selection from the Project list (http://forums.omnigroup.com/showthread.php?t=13115)

fudster 2009-07-21 11:15 PM

Applescript: obtain selection from the Project list
 
I've seen how we can obtain (i.e and subsequently iterate over) the selected projects/tasks using "selected trees or "every selected tree", when that selection is in the main content window.

But I'm having a heck of a time figuring out how to do the same for the selection(s) in the project list on the left. I was to perform operations on (and within) those using Applescript.

Any hints? Thanks in advance.

RobTrew 2009-07-22 12:17 AM

[QUOTE=fudster;63098]I'm having a heck of a time figuring out how to do the same for the selection(s) in the project list on the left. I was to perform operations on (and within) those using Applescript.[/QUOTE]

[CODE]set lstTrees to the selected trees of content
if the (count of lstTrees) is less than 1 then
set lstTrees to the selected trees of sidebar
end if[/CODE]

fudster 2009-07-22 09:55 AM

Ah, sidebar huh... RobTrew, that works perfectly - thanks!

One more question about selection, if I may... I'd like to have a way to determine from AppleScript the order in which the trees were selected...

So, say I have:

Folder1
- Project1
- Project2

If I select Project2, then hold down the Cmd key to select Project1, the order I get when I iterate using "repeat with" is the top-to-bottom order in which the projects appear in OF (not surprising, of course).

For what I'm doing now, I want to ascribe a significance to the first project I select (the other projects are dependent on completion of the first one; I want to set project statuses and insert tasks with linkages).

For this scenario I could display a dialog for selection of the currently-active project, but I'd prefer to be able to select that project first and then select the other "blocked" projects subsequently using multi-select. Does anyone know of a way to read the order in which the trees were selected, in AppleScript?

RobTrew 2009-07-22 11:53 AM

[QUOTE=fudster;63151]I'd like to have a way to determine from AppleScript the order in which the trees were selected...[/QUOTE]

I think you'll find that this information is not recoverable - the sequence of elements in [I]selected trees[/I] is not affected by the order in which they were selected.

fudster 2009-07-22 04:18 PM

thanks RobTrew... I'm proceeding with the list-dialog approach...

Cheers!


All times are GMT -8. The time now is 02:44 AM.

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