The following script makes a new entry in Project: Email Reply with Context:email without opening the quick entry window.
Code:
tell application "Microsoft Entourage"
-- get the currently selected message or messages
set selectedMessages to current messages
-- if there are no messages selected, warn the user and then quit
if selectedMessages is {} then
return
end if
repeat with theMessage in selectedMessages
set theName to subject of theMessage
set theSender to display name of sender of theMessage
set theContent to content of theMessage
set theID to ID of theMessage as string
tell application "OmniFocus"
log "Importing from Entourage, message ID = " & theID
end tell
set theCommand to "mdfind com_microsoft_entourage_recordID==" & theID
set theMDfile to the first item of paragraphs of (do shell script theCommand)
tell application "OmniFocus"
tell default document
set theContext to context "email"
set theProject to project "Email Reply"
set theTitle to theSender & ": " & theName
set NewTask to make new inbox task with properties {name:theTitle, note:theContent, context:theContext}
set assigned container of NewTask to theProject
tell the note of NewTask
make new file attachment with properties {file name:theMDfile, embedded:false}
end tell
compact
end tell
end tell
end repeat
end tell