Help with Outlook 2011 to DTP workflow

Hi,
I am a Mac and DTPO newbie looking for some help. I have munged together a script that I found to import an Outlook email message into DTPO and a couple of Automator actions that open a floating window allowing me to select a target group and add tags.

This works just fine, but the Set Current Group action opens a new DTPO window, and I want to use the existing window.

I am hoping that someone can help me edit the .action file so that a new window isn’t created each time, or tell me if there’s an easier way to accomplish this.

TIA
Joe

Joe, if you post your code perhaps some of the readers could take a look and suggest a fix?

Thank you!

Here is the script, which seems to work fine (I used one of the scripts from the message boards, if I recall).

After the script runs, Automator hands off the results to the ‘Set Current Group’ action, which states in the description, ‘A new window will open which displays the content of the selected group. If the originally selected group is not available, the inbox will be used.’

The workflow passes to the ‘Move Records to Current Group’ action, and the workflow completes.

The behavior I am trying to correct is in the ‘Set Current Group’ action, which is working as designed. I don’t know enough to know if it’s even possible to get into the guts of the .action bundle and make the necessary adjustments. I am guessing, but it appears that the code is in an xml file of some sort.

Anyway, here is the script - thanks for taking a look!

Joe


property pNoSubjectString : “(no subject)”

tell application “Microsoft Outlook”
try
set theSelection to the selected objects
if theSelection is {} then error “One or more messages must be selected.”

	tell application id "com.devon-technologies.thinkpro2"
		if not (exists current database) then error "No database is in use."
	end tell
	
	repeat with theMessage in theSelection
		try
			set theSubject to subject of theMessage
			set theSender to sender of theMessage
			set theSender to (address of theSender) as string
			set theSource to source of theMessage
			set theDateReceived to time received of theMessage
			set theDateSent to time sent of theMessage
			if theSubject is equal to "" then set theSubject to pNoSubjectString
			
			set theCategories to {}
			set theList to (category of theMessage)
			repeat with theCategory in theList
				set theCategories to theCategories & (name of theCategory)
			end repeat
			set isFlagged to true
			if todo flag of theMessage is (not flagged) then set isFlagged to false
			set isUnread to is read of theMessage
			
			tell application id "com.devon-technologies.thinkpro2"
				set theRecord to create record with {name:theSubject & ".eml", type:unknown, creation date:theDateSent, modification date:theDateReceived, URL:theSender, source:(theSource as string)}
				if theCategories is not {} then
					set theTags to tags of theRecord
					set theTags to theTags & theCategories
					set tags of theRecord to theTags
				end if
				if isFlagged then set state of theRecord to true
				if isUnread then set unread of theRecord to true
			end tell
		end try
	end repeat
on error error_message number error_number
	if the error_number is not -128 then display alert "Outlook" message error_message as warning
end try

end tell

return {theRecord}

Sorry - perhaps I should have been more clear -

the end result I am after is that it works exactly the way it does now, only without opening up a new DT window.

Thanks
Joe

I was just curious to know if there was ever a resolution to this. I would love to be able to use this script for mass imports from Outlook, but having to choose a location for every single email message can get tedious, especially since they are all going to the same folder.

Can anyone tell me how I would use this to be able to specify for individual emails which folder and what tags to add to an email I want to send to DT from Outlook? I only do one email at a time so opening a new workspace isn’t a problem. I’m just wondering what exactly I have to do – what exactly I need to copy and paste – and where I need to put that and anything else I need to do to be able to run this script. I’m a newbie at using scripts so I need specifics. Thanks in advance!

If you use the provided script in the global script menu in Outlook and you have DEVONthink’s Preferences > Import > Destination set to Select group, you can choose the destination group when importing the email.

If you enable File > Database Properties > Inherit Tags of Groups for the database you’re saving to, you can add a tag to the destination group and any files put in the group would inherit the tag of the parent group.

Do you need something more complex than this?

Thanks, the Import preferences was definitely helpful. Great!

Is there a way to set all notes within a group to inherit the group’s tags? I don’t see that. I don’t want to set the preference within my database for all the groups to inherit a tag, but for all the notes I put into a group it would be really useful.

Lastly, is there a way to be able to change the title of an email that I want to import into DT?

Thanks,
Hilary

This doesn’t change the import behaviour for me when I bulk import a number of emails …