View Single Post
Quote:
Originally Posted by steve View Post
So, is this working now? It sounds like a great idea. I was wondering if someone could copy/paste the code— it seems like there have been a few additions and I'm not quite sure where to add those.

Thanks,
Steve
Steve, yes it is working now. Also I modified it to work with LaunchBar. Here is the code without Launchbar support:

Code:
display dialog "Enter Project to Find" buttons {"Cancel", "Find"} default button 2 default answer "" with title "Project Find"
if button returned of result is "find" then
	set ProjectString to text returned of result
	tell application "OmniFocus"
		set MyDoc to default document
		tell MyDoc
			set MyProjectArray to complete ProjectString as project maximum matches 1
			set MyProjectID to id of first item of MyProjectArray
			set ThisProject to project id MyProjectID
			set newW to make document window with properties {focus:{ThisProject}, selected view mode identifier:"project", search term:""}
			set (selected smart group identifier of sidebar of newW) to "remaining-projects"
			set selected task state filter identifier of content of newW to "incomplete"
			-- set selected task state filter identifier of content of newW to "all"
			activate
		end tell
	end tell
end if
And here it is with Launchbar support...

Code:
on handle_string(ProjectString)
	if ProjectString is not "" then
		tell application "OmniFocus"
			set MyDoc to default document
			tell MyDoc
				set MyProjectArray to complete ProjectString as project maximum matches 1
				set MyProjectID to id of first item of MyProjectArray
				set ThisProject to project id MyProjectID
				set newW to make document window with properties {focus:{ThisProject}, selected view mode identifier:"project", search term:""}
				set (selected smart group identifier of sidebar of newW) to "remaining-projects"
				set selected task state filter identifier of content of newW to "incomplete"
				-- set selected task state filter identifier of content of newW to "all"
				activate
			end tell
		end tell
		open location "x-launchbar:hide"
	end if
end handle_string
I am going to enhance to accept some parameters like what filter settings to display and thing like that.

Thanks again for all the help.

George