How do you tell applescript to use a sub group as theGroup?

I am trying to modify a script that imports email and attachments into DTPO. I have a group called “Archive” with a sub-group called “Attachments.”

I am trying to get this line to work:

tell application id "com.devon-technologies.thinkpro2"
set theAttachmentRecord to import theFile to "Attachments"

I expect it to use the sub-group "Attachments," but it creates a new top-level group called "Attachments" instead. I figure I must be close, because it does place the attachment in the group that it creates... it just isn't the right group. :slight_smile:

What am I doing wrong?

You want to specify the location (the POSIX path to the target group) in the command that creates a record with your attachment. For example:

set theRecord to create record with {name:"My Name", location:"Attachments" }

You didn’t post enough of your script to be able to be more specific about this.

See also the sample mail import scripts that come in the DEVONthink installation.

Thanks Korm,

That was enough to get me going. All I needed to do was change

set theAttachmentRecord to import theFile to "Attachments"


set theAttachmentRecord to import theFile to create location "Archive/Attachments"

Now everything works brilliantly.