<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 13 Jan 2019, at 12:52, leo wrote:</p>

</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">I’ve changed the devonthink-pro bundle a little bit (Corrected the Mofied date), but I really would like to add a feature to **tag the message in MailMate automatically on export to DEVONthink with a fixed tag** (“in-devonthink”).<br>
<br>
How could I achieve this? Do I set the output key to actions and then create in the add bash script an property list on stdout with the changeFlags type?</p>
</blockquote></div>
<div style="white-space:normal">

<p dir="auto">Yes.</p>

</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">Does anybody have an example for something like this in one of the bundles?</p>
</blockquote></div>
<div style="white-space:normal">

<p dir="auto">Here's one using the support for JSON in more recent versions of MailMate:</p>

<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">#!/usr/bin/python
import json

actions = { 'actions': [ { 'type': 'changeFlags', 'enable': [ 'AddThis', 'AndThis' ], 'disable': [ 'RemoveThis' ] } ] }
print json.dumps(actions)
</code></pre>

<p dir="auto">Here's a more crude approach outputting a raw property list in a bash script.</p>

<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">cat << ENDL
{
    actions = (
        {
            type = 'changeFlags';
            enable = ( "AddThis", "AndThis" );
            disable = ( "RemoveThis" );
        },
    );
}
ENDL
</code></pre>

<p dir="auto">Note that the “flags” must be the IMAP keywords used for the tags (and not the display names).</p>

<p dir="auto">Alternatively, setup a custom key binding which calls the bundle command <em>and</em> changes the tag.</p>

<p dir="auto">-- <br>
Benny</p>
</div>
</div>
</body>
</html>