The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Scripting bridge: crash when trying to get child tasks of a task Thread Tools Search this Thread Display Modes
I'm using the Scripting Bridge to control OmniFocus. If I write this code:

			for (OFTask *task in project.rootTask.flattenedTasks)
				NSLog(@"Task %@",;
I get a crash. "project" is a valid OmniFocus project (I can log its name etc). Calling "project.rootTask" works fine. But when I ask for "flattenedTasks", I get this crash:

2012-07-07 15:17:27.635 OmniReviewer[18623:403] -[SBObject classForCode:]: unrecognized selector sent to instance 0x7fd539607ea0
The same thing happens if I just ask for "tasks" rather than "flattenedTasks".

Does anyone have any idea why I can't seem to get the child tasks of a task?
Have you tried project.flattenedTasks ?

(The root task of project is a rather strange and special case, it is really a reference to the project itself A project is just a decorated task)
Sadly, there's no such property. The only things that have a "flattenedTasks" property are tasks and documents.

The comment for the rootTask property of a project says "The root task of this project, holding the project's name, note, dates and child tasks.", which is what led me to think you're meant to do it that way.
Curious ...

That's not what theory would predict you can certainly access the flattened tasks of a project through the Applescript dictionary ...

Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2012-07-07 at 16.24.07.png
Views:	903
Size:	33.4 KB
ID:	2453   Click image for larger version

Name:	Screen Shot 2012-07-07 at 16.21.02.png
Views:	905
Size:	64.9 KB
ID:	2454  
A full llist of the classes from which flattened task elements can be accessed:

Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2012-07-07 at 16.38.56.png
Views:	1654
Size:	21.1 KB
ID:	2455  
It's odd: the Scripting Bridge thing that generates headers didn't generate any "tasks" property on "project".

So I tried doing it manually:

SBElementArray *arr = [project elementArrayWithCode:'FCac'];
Sadly that gave the same error as I was originally experiencing :(

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripting Bridge & NSColor pixel OmniGraffle General 0 2009-12-07 12:19 PM
Problem Using Scripting Bridge and OmniGraffle pixel OmniGraffle General 1 2009-12-03 09:52 AM
Scripting Bridge & OOP namedStyles oopFan AppleScripting Omni Apps 0 2008-11-03 03:46 PM
Export issue / Modify the selection in a Document via AppleScript / Scripting Bridge Scifer_2008 OmniGraffle General 0 2008-10-08 07:06 AM
Problems using Scripting Bridge and OmniFocus 2shortplanks OmniFocus Extras 8 2008-08-09 10:35 PM

All times are GMT -8. The time now is 09:07 PM.

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