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

 
AppleScript Requests Thread Tools Search this Thread Display Modes
Here's a slightly improved version. It creates an invisible window to do the data extraction, so your existing windows aren't affected, and it handles the case of an action without a context.

Code:
property TargetPerspective : "Geek Tool" -- set this to the name of the perspective that shows desired actions

set taskList to ""
tell application "OmniFocus"
	tell default document
		set _window to make new document window with properties {visible:false} at front of document windows
		tell _window
			set perspective name to TargetPerspective
			set oTrees to trees of content
			set n to count of oTrees
			repeat with i from 1 to n
				set oTask to value of (item i of oTrees)
				set taskTitle to name of oTask
				try
					set projContext to name of context of oTask
				on error
					set projContext to "(No Context)"
				end try
				set taskList to taskList & "     " & taskTitle & "  (" & projContext & ")
"
			end repeat
		end tell
		close _window
	end tell
end tell
return taskList
 
Quote:
Originally Posted by whpalmer4 View Post
Here's a slightly improved version. It creates an invisible window to do the data extraction, so your existing windows aren't affected, and it handles the case of an action without a context.
That is just brilliant whplamer4! Thank you! I had actually only just encountered the 'no context' problem and here you've already solved it for me. Moving the Perspective name to the start is handy too.

I'm really happy with this script now :) Should cover most eventualities and means the fact that mobileme iCal no longer works with Omnifocus is not an issue.
 
As a curiosity, here is an Sqlite version. Arguably less easy to maintain (the SQL queries are probably less transparent than applescript, and might need to be adjusted for later versions of OF).

On the other hand, it's rather short and simple, works even when OmniFocus is not running, and is quite fast.

Code:
property pstrDBPath : "~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2"
property pstrFieldDelimiter : tab

set strQuery to "
select \"   \", t.name, \"(No Context)\" from task t  where context is null order by t.name;
select \"   \", t.name, c.name from task t join context c on t.context=c.persistentIdentifier 
where effectiveActive=1 and dateCompleted is null order by c.name, t.name;
"
set taskList to runquery(strQuery)

on runquery(strQuery)
	set strCmd to "sqlite3 -separator '" & pstrFieldDelimiter & "' " & pstrDBPath & space & quoted form of strQuery
	do shell script strCmd
end runquery

Last edited by RobTrew; 2010-11-20 at 04:11 PM..
 
Hi,
I have a script that works as a folder action that I could share that should get you close to what you are looking for. I am not sure if folder actions work with Delphic so it might need to be scheduled to run. If you are still looking just reply and I will post it
 
My previous port was in reply to
Quote:
Originally Posted by theurge View Post
My wife and I have a shared dropbox folder where she periodically drops a .txt file list of stuff she'd like me to do from her windows machine, which I open, copy the list and paste it in the inbox, using the method that splits each line into a separate task.

I would love to do something like: have hazel watch that shared folder for a new .txt file, grab it and run an applescript that will do the above automatically.

I'm a complete novice with applescript, but I've done a lot of reading and seen little snippets of script that look like parts of what I would need, but I've had no luck putting them together. Any ideas folks?
 
Hi!

I bet my request is simple and I merely have been too lazy in searching the archives for an answer. :-)

I'd like to ge able to tag an outgoing email with a specific MailTags tag "@Waiting" and have a rule fire an AS to create a follow up to do in OF. The date for the follow up would pull from the Tickler date or a default # of days if not specified.

As a bonus, the OF Context for the task could be determined from the outgoing email address if it is one of the people on my team (5 people).

I'll hire someone to work on this with me if there isn't something here easily convertible.

Thanks,
Adam Aronson
FullCity Consulting Inc.

Certified FileMaker Developer (Ver. 7, 8, 9, 10 & 11)
Platinum FileMaker Business Alliance Members
2007 FileMaker Business Partner of The Year

http://fullcityconsulting.com
 
Sorry, RussBlaisdell, its been a while, and this little project has just dropped of my radar. I would love to have a look at what you've got. I'm not sure how much time or intelligence I have to do anything with it, but you never know. Thanks.

Quote:
Originally Posted by RussBlaisdell View Post
Hi,
I have a script that works as a folder action that I could share that should get you close to what you are looking for. I am not sure if folder actions work with Delphic so it might need to be scheduled to run. If you are still looking just reply and I will post it
 
I would second that I would really like a script that would read a text file and add an item from each line.

I use a script right now where I select each line and send it to LaunchBar. Launchbar makes a task in omni, and it accepts this form: task >project @context

If there were a way to put each line into this script... or each line within a certain marker? I'm not a programmer, it seems like an easy task, but I don't know.

The Launchbar script is at:

http://forums.obdev.at/viewforum.php?f=24
 
Quote:
Originally Posted by Noel Roy View Post
I would second that I would really like a script that would read a text file and add an item from each line.

I use a script right now where I select each line and send it to LaunchBar. Launchbar makes a task in omni, and it accepts this form: task >project @context

If there were a way to put each line into this script... or each line within a certain marker? I'm not a programmer, it seems like an easy task, but I don't know.
There are probably a number of variants out there, but something roughly like this would be one simple approach (for selecting several lines and using LaunchBar 'Instant Send' (dbl option tap, for example) to process them in one batch, making each line into a separate task).

Code:
-- LaunchBar script for parsing several lines of selected text to several tasks

on handle_string(str)
	tell application id "OFOC"
		if str ≠ "" then
			-- PARSE TASKS
			set lstParas to paragraphs of str
			tell default document
				repeat with oLine in lstParas
					parse tasks with transport text oLine
				end repeat
			end tell
			
			-- AND REPORT SUCCESS WITH A GROWL NOTIFICATION IF GROWL IS RUNNING
			my Growlify("Create OF Tasks from text", "OF Tasks created", 
				((count of lstParas) as string) & " tasks created in OmniFocus:" & return & return & str)
		end if
	end tell
end handle_string


on Growlify(strApp, strNote, strMsg)
	tell application id "sevs"
		if (count of (processes where bundle identifier is "com.Growl.GrowlHelperApp")) > 0 then
			tell application id "com.Growl.GrowlHelperApp"
				register as application strApp all notifications {strNote} 
					default notifications {strNote} 
					icon of application "OmniFocus"
				
				notify with name strNote title strNote 
					description strMsg application name strApp
			end tell
		end if
	end tell
end Growlify

Last edited by RobTrew; 2012-07-07 at 11:51 PM.. Reason: 'dbl opt click' --> dbl opt *tap* (for instant send)
 
Thank you so so much Rob!! This is totally amazing.

-Noel.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perspective Requests Stephen Brown OmniFocus for iPad 4 2012-02-12 08:01 AM
Two requests gshenaut OmniFocus 1 for Mac 3 2011-01-08 09:06 AM
Feature Requests specialmoves OmniGraffle General 1 2008-06-26 03:54 PM
Feature/UI Requests Jon Hicks OmniWeb General 88 2007-03-15 02:08 PM
Few requests... thestaton OmniWeb Feature Requests 2 2006-11-15 12:57 PM


All times are GMT -8. The time now is 03:53 AM.


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