View Single Post
Quote:
Originally Posted by grichar1 View Post
For reference, I was referring to the ability Clip-O-Tron has to use a MailTags Project name, if present and equal to an OF project name, as the project of the new task. I can't find this functionality in any of the scripts, current or past, for moving mail to OF. I had another look at the scripts included in this Forum and couldn't find anything. If you know of one I could use as a template, please let me know.
Inside the OmniFocus app itself you'll find the AppleScript code used to handle clipping from MailTags, in OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Mail-with-MailTags.applescript.

Here are the relevant excerpts:

Code:
using terms from application "MailTagsScriptingSupport"
	set MyProjectName to project
end using terms from

tell MyTask
	set MyProject to missing value
	try
		if MyProjectName is not missing value then -- will raise if the value is undefined/null
			tell containing document
				set MyPossibleProjects to complete MyProjectName as project maximum matches 1
				if (count of MyPossibleProjects) is not 0 then
					set MyProjectID to (id of item 1 of MyPossibleProjects)
					set MyProject to project id MyProjectID
				end if
			end tell
		end if
	end try
end tell
There are a number of other scripts bundled inside OmniFocus.app which might be useful reference material:

Code:
% find OmniFocus.app -name '*.applescript'
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Default.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Finder.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Mail-Leopard.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Mail-with-MailTags.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/NetNewsWire.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/OmniPlan.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/OmniWeb.applescript
OmniFocus.app/Contents/PlugIns/BuiltInClippingHandlers.plugin/Contents/Resources/Safari.applescript
OmniFocus.app/Contents/Resources/MailAction.applescript
OmniFocus.app/Contents/Resources/SampleScripts/DumpContextTasks.applescript
OmniFocus.app/Contents/Resources/SampleScripts/Publish to iCal.applescript
OmniFocus.app/Contents/Resources/SampleScripts/Send to OmniFocus.applescript
OmniFocus.app/Contents/Resources/UpdateMailActionInstallation.applescript
Hope this helps!