Poco Events -

Poco 2.61 introduced the ability to run filters and scripts in response to a number of events. This document lists those events, provides a short description of them and documents the value the #PocoScriptMode variable will have for the event.

EventDescription#PocoScriptMode
OnAddRuns whenever a message is added to a mailbox. The message might be added as the result of a filter or script, as the result of dragging the message to the mailbox or via the "Move Message to Mailbox" item on the mailbox index context menu.101
OnBounceWhen a message is bounced to another user (before the message body has been formatted).136
OnBounceEditSame as "OnBounce" except the message has already been formatted for editing.146
OnComposeWhen a window is opened to compose a new message.131
OnDisplayWhen a message is formatted for display. Changes made to a messaged by an onDisplay event filter or script affect only the message as it is displayed, not the message as it is stored in the mailbox.121
OnForwardWhen a message is being forwarded to an individual, prior to the message text being formatted in the message.134
OnForwardAttForwarding a message as an attachment, before the message has been formatted.135
OnForwardAttEditForwarding a message as an attachment, after the message has been formatted.145
OnForwardEditWhen a message is being forwarded to an individual, after the message text has been formatted in the message.144
OnReplyWhen a reply (to the original sender) is being composed (before the text has been formatted in the reply window).132
OnReplyAllWhen a reply (to all recipients of the message) is being composed (before the text has been formatted in the reply window).133
OnReplyAllEditWhen a reply (to all recipients of the message) is being composed (after the text has been formatted in the reply window).143
OnReplyEditWhen a reply is being composed (after the text has been formatted in the compose window).142
OnStartupRuns scripts/filters when starting Poco20
OnTimerRuns scripts/filters at startup and at specific intervals thereafter.10
OnQuitRuns scripts/filters as Poco is being shutdown.25

Footnotes

  1. These events have access to the original message prior to any quote marks, headers or footers are inserted. Any text added to the message by the script will have quote marks applied to it.
  2. These events ahve access to the message after it has been formatted. Quote marks, headers and footers ave already been added by Poco. Any text added to the message will not be subject to quoting.

Specifying the scripts to use for an event

Poco 3 has a GUI interface for configuring events. Select "Tools | Events" (or Ctrl+F9) to display the form.

Poco 2.x provides the facility to invoke scripts in response to the above events no GUI support is provided for configuring which scripts will be launched in response to the event. This must be done by manually editing the Poco configuration files.

Be sure to shutdown Poco before making any of these changes!

Events can be specified on

Each specification must be made in a different file, consult the list below for where the entry should be made.

When events are defined across multiple levels then all events will be executed with the mailbox specific ones executing before folder level which are in turn before application wide events.

Regardless of the level of the event the syntax of the specification is the same. At the bottom of the respective file enter [Events] on a new line to indicate the start of the event specification section. On following lines define the scripts to be executed and the events they are to be executed for using the following syntax:

EventType_Scripts=script1,script2,script3
For example, to specify that the Reformat and InsertWittyComment scripts are to run when you reply to a message in your "Friends" folder you would create a "folder.ini" file containing the following lines and place it in the "Friends" folder:

[Events]
OnReplyEdit_Scripts=Reformat,InsertWittyComment

Application wide events

These events will be fired whenever the action occurs regardless of the mailbox for which the event occurs. The specification of the events is done by adding an entry to the Poco.ini file. Application wide events are executed after folder level and mailbox level events.

Folder level events

Folder level events are made by creating a "Folders.ini" file and specifying the event and script names in it. This file must be stored in the root folder from which the events are to be spawned. The events will be executed for all mailboxes and folders nested within that folder; if there are more than one FOLDERS.INI file above a mailbox all of the events in each file will be run.

Folder level events are executed after mailbox level events but before application wide events.

Mailbox specific events

These events are executed only when the event occurs for a specific mailbox. These events are specified in the .dat file for the mailbox.

Mailbox level events are executed before both folder level and application wide events.

Specifying filters to use for an event

In general you need to follow the same rules for specifying scripts for use in events. For the most part you will want to run a set of manual filters in response to the event. The syntax for the specification differs as follows:

You need to tell Poco that you want to run a set of filters rather than a script; use the following syntax:

[Events]
OnReplyEdit_Filters=n

Where "n" is a number specifying the set of filters you want to run as outlined in the following table:
Filter setn
Incoming0
Outgoing1
Pre-download2
Post-Send3
Manual 14
Manual 25
Manual 36
Manual 47