Import email with Mail Rule Action Import to specific folder

Hi,

I have read many posts somewhat similar to this but I can’t follow for the life of me. How can I change this scrip to go to a specific group (one that is a sub group of another)?

The script is below for reference.

Thanks in advance.

-- Mail Rule Action Import to DEVONthink Pro.
-- Created by Christian Grunenberg on Mon Apr 19 2004.
-- Copyright (c) 2004-2012. All rights reserved.

-- this string is used when the message subject is empty
property pNoSubjectString : "(no subject)"

using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		tell application "Mail"
			repeat with theMessage in theMessages
				try
					tell theMessage
						set {theDateReceived, theDateSent, theSender, theSubject, theSource, theReadFlag} to {the date received, the date sent, the sender, subject, the source, the read status}
					end tell
					if theSubject is equal to "" then set theSubject to pNoSubjectString
					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)} in incoming group
						set unread of theRecord to (not theReadFlag)
					end tell
				end try
			end repeat
		end tell
	end perform mail action with messages
end using terms from

Suppose you want to import the messages in the “Carnivores” subgroup of the “Mammals” group in your “Zoology” database. To do so you first need a reference to that group:


set theGroup to get record at "/Mammals/Carnivores" in (database named "Zoology")

then change “in incoming group” in the script into “in theGroup” and it should work.