View Single Post
Quote:
Originally Posted by millerj View Post
This may be because the project title, , has a colon in it? This appears to be the cause of this problem
Thanks, that's helpful, and I'll take a look at it.

In the meanwhile, if you want to experiment with something very simple, you could start with a draft like this:

(Even this had to be amended to purge any colons from the file name :-)

Code:
property pstrAppSupport : (path to application support from user domain as string)

tell application id "com.omnigroup.omnifocus"
	set oWin to front document window of front document
	
	set lstObjects to value of selected trees of content of oWin
	set strText to ""
	repeat with oObject in lstObjects
		set strText to strText & "- " & name of oObject & return
		set strNote to note of oObject
		if strNote is not "" then set strText to strText & strNote & return
	end repeat
end tell

--tell application id "com.apple.finder" to set the clipboard to strText

tell application id "com.apple.TextEdit"
	set strName to first paragraph of strText
	
	-- PURGE COLONS (FILE SYSTEM SEPARATORS) FROM FILE NAME
	set my text item delimiters to ":"
	set lstParts to text items of strName
	set strName to ""
	repeat with oPart in lstParts
		set strName to strName & oPart & space
	end repeat
	set my text item delimiters to space
	
	set strName to strName & ".txt"
	set oDoc to make new document with properties {text:strText, name:strName}
	save oDoc in pstrAppSupport & "DEVONthink Pro 2:Inbox:" & strName
	close oDoc
end tell

Last edited by RobTrew; 2010-08-21 at 06:29 AM.. Reason: Code amended to purge ":" from file names