Script to import flagged email to devonthink

Does it absolutely need to be items in the smart mailbox that get imported?
Otherwise, you could just duplicate messages to be imported into a specific Mail folder and use this script in combination with keyboard maestro to automate the importing. It’s pretty simple to set up and works great.