View Single Post
I am using Mail Act-On with Apple Mail to send emails to my OmniFocus inbox. I use a key command (courtesy of Mail Act-On) to fire off a series of actions, one of which is to run an AppleScript.

I have been using a modified "Send to OmniFocus" AppleScript and it has been working well, but it can only take the subject of the selected email and put it in the title of the OmniFocus item.

I want to be able to change the title of the item before it is added to OmniFocus, so I modified the script a bit to display a dialog into which I can enter a different title for the item.

Everything works great except that the text that is entered somehow gets converted to Asian characters and so is totally unreadable by mono-lingual little old me.

I can't imagine why this could be happening, but then, I'm an AppleScript novice. So, I turn to you and ask, "what's wrong with this picture?"

using terms from application "Mail"
	on perform mail action with messages theMessages
		tell application "Mail"
			repeat with eachMessage in theMessages
				set theStart to missing value
				set theDue to missing value
				set theTitle to the subject of eachMessage
				set theNotes to the content of eachMessage
				set theSender to sender of eachMessage
				set itemTitle to theTitle
				-- Display dialog to allow user to specify the Title for the new OmniFocus Inbox item
					set itemTitle to display dialog "Item title" buttons {"Cancel", "Save"} default button "Save" cancel button "Cancel" default answer (theTitle)
				on error number -128
					set userCanceled to true
				end try
				set theCombinedBody to "Created from message:%3C" & message id of eachMessage & "%3E" & return & "From: " & theSender & return & return & theNotes
				tell application "OmniFocus"
					tell default document
						set newTaskProps to {name:itemTitle}
						--						if theStart is not missing value then set newTaskProps to newTaskProps & {start date:theStart}
						--						if theDue is not missing value then set newTaskProps to newTaskProps & {due date:theDue}
						if theCombinedBody is not missing value then set newTaskProps to newTaskProps & {note:theCombinedBody}
						set newTask to make new inbox task with properties newTaskProps
					end tell
				end tell
			end repeat
		end tell
	end perform mail action with messages
end using terms from
I don't know if you need Mail Act-On to even test this, but any suggestions as to why this might be happening (or even better, a solution) would be most appreciated!