In Options | Scripting and Templates you can create scripts that are triggered by various conditions. One of those triggers is Mail Storage which is a Message Trigger. Whenever mail is stored in a mailbox after being delivered by the router scripts with this trigger will be activated. Until now, however, this excluded messages stored in a mailbox using IMAP because they bypassed the router. Now when you send a message in your IMAP client and that client puts a copy in the "Sent Items" folder, scripts can be triggered. Similarly, messages copied from one folder to another can trigger such scripts.
If you want the script to trigger for one specific mailbox then create a filter that matches the field "#rcpt" to the name of the mailbox.