[Users] Limitations of Python scripts
berndth at gmx.de
Wed Apr 17 22:24:27 CEST 2013
On Mi, 17.04.2013 11:41, alb348 at gmail.com wrote:
>I am trying to understand the limitations of Python scripts in Claws Mail.
>According to a Youtube tutorial, only menu commands are accessible.
no, that a 4 minute demo video just shows a few things doesn't mean
that nothing else can be done.
>Does this mean that accessing the actual contents of an email and
>processing it cannot be done?
Accessing the contents of the mail is not directly implemented (but you
can query the filepath, and it should be possible to interpret it with
Python standard libs).
>What I have in mind is:
>accessing the email content, searching for keywords, maybe replacing
>some of the text, saving the message, making a clone of the message and
>saving it somewhere else, triggering some external programs (not Python
>scripts) in the event a given string is found in the message, etc...
>Can these functions be done via Python scripts?
That depends on what exactly you want. Modifying a message by querying
the filepath, for example, has the same limitations as modifying it via
actions or externally has. Triggering external programs shouldn't be a
problem (with the Python subprocess module, or whatever other way you
like). Moving / copying message should not be a problem either.
>More in general, I would like to know from someone who uses the Python
>scripts in CM intensively how they work overall,
When something seems of more general interest, I add it to the
"examples" folder of the plugin distribution.
>and what are their main limitations.
Claws Mail doesn't use GObject or some other introspectable basis
that would make providing access to a scripting language easy. The
interfaces the Python plugin provides are hand-written, and thus far
from complete. As the module documentation states, "The interface to
Claws Mail in this module is extended on a 'as-needed' basis."
So personally, I don't face limitations - because when I do, I tend to
add the feature to the plugin. I also added requested interfaces, but
that's of course subject to time and motivation constraints.
More information about the Users