View Single Post
I wrote my own script to get the iPad's email feature.
It could be improved, because i'm just replacing blanks, in further version it would be useful to replace other strings like: ', ", /, ...
At the moment they break the omnifocus url.

It would be useful if somebody could post an link generated with the iPad version full of special characters.

Have fun, but keep in mind, that it'll only work if you have plain text without special characters inside your task and note!!

Only one selected task can be send...

Code:
-- by competition
tell application "OmniFocus"
	tell front document
		tell document window 1
			set theSelectedItems to selected trees of content
			
			
			if (count of theSelectedItems) = 0 then
				try
					display dialog "No task selected!"
				end try
			else
				set theName to name of item 1 of theSelectedItems
				set theNote to note of value of item 1 of theSelectedItems
				
				
				-- No empty notes
				if theNote is "" then
					set theFinalNote to ""
				else
					set theFinalNote to "&note=" & my replaceString(theNote, " ", "%20")
				end if
				
				set omniLink to "omnifocus:///add?name=" & my replaceString(theName, " ", "%20") & theFinalNote
				
				tell application "Mail"
					set myMessage to make new outgoing message with properties {subject:"Omnifocus: " & theName, content:omniLink}
					set visible of myMessage to true
					activate
				end tell
			end if
		end tell
	end tell
end tell


-- Replace spaces
on replaceString(theText, oldString, newString)
	set AppleScript's text item delimiters to oldString
	set tempList to every text item of theText
	set AppleScript's text item delimiters to newString
	set theText to the tempList as string
	set AppleScript's text item delimiters to ""
	return theText
end replaceString