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 Today's Posts

 
OF Task to Mail Thread Tools Search this Thread Display Modes
Hello,

I searched the forums but couldn't find what I was looking for:
Is there a script that will take the selected task in OF and create an email message with the subject of that task and maybe any attachments that it might have?

Can somebody help with this?

The reason I ask for it is that I have lots of tasks that I delegate via email to other people. Now I work in this way:I createad a context for each people and now I send a pdf with all these tasks
Thanks
 
Hi Mushudog,

I'm a beginner with applescript but managed to hack together a script for you.

The scipt is largely based on the complete and awaiting reply script by Curt Clifton.

Curt Clifton graciously allowed me to post this modified script which I hope meets your needs.

Regards,

Jhn

Code:
(*

This script will take the currently selected action in OmniFocus and send it to mail, completing that action in OmniFocus and create a new "waiting for action".

The context, action prefix and suffix can be changed by changing the waitingForContext, WaitingPrefix and WaitingSuffix properties respectively.

Script by jhncbrwn (c) 2009

Based on an original script copyright © 2007-2008, Curtis Clifton


	This script marks the selected actions as complete and creates new actions in a "Waiting For" context to track replies.
	
	version 0.1, by Curt Clifton
	
	Copyright © 2007-2008, Curtis Clifton
	
	All rights reserved.
	
	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
	
		• Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
		
		• Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
		
	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
	
	version 0.1: Original release*)

--Here you can assign the context, the prefix and suffix
property waitingForContext : "wf"
property waitingPrefix : "Waiting for: "
property WaitingSuffix : "Delegated"

--This configures the date
set dateX to (current date) + (0 * days)
set A to ((month of dateX as number) + 100) as string
set b to ((day of dateX) + 100) as string
set c to ((year of dateX) + 100) as string

tell A
	text 2 thru 3
end tell
set mm to result

tell b
	text 2 thru 3
end tell
set dd to result

tell c
	text 3 thru 4
end tell
set yy to result

set Current_date to dd & "/" & mm & "/" & yy as string

--This creates the new action
set itemTitle to missing value
tell application "OmniFocus"
	tell front document
		-- Gets target context
		set theContextID to id of item 1 of (complete waitingForContext as context)
		set theWaitingForContext to first context whose id is theContextID
		tell content of document window 1 -- (first document window whose index is 1)
			set theSelectedItems to value of every selected tree
			if ((count of theSelectedItems) < 1) then
				display alert "You must first select an item to complete." as warning
				return
			end if
			repeat with anItem in theSelectedItems
				set itemTitle to name of anItem
				set theDupe to duplicate anItem to after anItem
				set completed of anItem to true
				set theNote to note of anItem
				
				-- Configure the duplicate item
				set oldName to name of theDupe
				set name of theDupe to waitingPrefix & oldName & " (" & WaitingSuffix & " " & Current_date & ")"
				set context of theDupe to theWaitingForContext
				set repetition of theDupe to missing value
			end repeat
		end tell
	end tell
end tell

--This sends all of it to mail
tell application "Mail"
	set accountAddresses to (email addresses of first account)
	set fromAddress to first item of accountAddresses
	set theMessage to make new outgoing message
	set visible of theMessage to true
	set subject of theMessage to oldName
	set content of theMessage to theNote
	activate
end tell
 
dear Jhn,

Thank you for your time. I tried to run the script but I get an error:
Can't get item 1 of {}.
 
You need to create a 'Waiting for' context or edit the script to work with your existing waiting context.

@jhncbrwn (and Curt), nice work! I think this will be a useful script for me.
 
Indeed- works!
It is the most useful script I have!
Thank you all for this!
 
This script is great! I was thinking for some tweaking if somebody will be willing to do it. For example in the Waiting for context I have other subcontexts for people That I delegate to:
Waiting for: ->George
Waiting for: -> Mary and so on.

It would be great if after running the script a popup window will appear and ask you to select the person you delegate to (from the waiting for context) (the idea came after installing this script here: http://forums.omnigroup.com/showthread.php?t=12541 )
 
 




Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I forward a E-Mail to Omni and you make it a task? Librerio Applying OmniFocus 1 2011-10-30 01:37 AM
New task from Mail attachment only? RFBriggs OmniFocus 1 for Mac 9 2010-06-02 01:19 PM
Send task as e-mail Arild OmniFocus Extras 1 2010-03-09 02:44 AM
Omnifocus task/action to Apple Mail gandalf44 OmniFocus Extras 1 2009-05-27 12:53 PM
Creating Task from E-Mail? tango OmniFocus 1 for Mac 1 2007-06-29 02:17 PM


All times are GMT -8. The time now is 10:18 AM.


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