{ Script: SaveMessageDialog{ Created: 2005/09/25{ Author: Adi J. Sieker{ Mode: This script is designed to run from a button click.{ Purpose: Save a message to a specified mailbox.{ Description:{ When executed the script displays a messagebox in which the user{ can enter a mailbox name to save the mail to.{ If sender email is in the contacts, the script will prefill the{ dialog with the value from the first custom field.{ So you can predefine a mailbox in each contact, to which{ email from that person will per default be saved to.{ If the mailbox name entered in the dialog doesn't exist, it{ is autmatically created and the mailboxes are refreshed.{ This allows me to save a message to a per contact { predefined mailbox in 2 keystrokes. Ctrl+1 and <ENTER>.

Set $OnErrorGoTo "ErrorHandler"

Set $defBox ""

{read the sender of the mail}ReadHeader $from "From:" %messageExtractEMail $from CharCount #n $from{if we don't have a recipient jump to the selection dialog}If #n = 0 Then RequestMailBox

{read a mailbox name from the first custom field}GetAddressField $defBox $from "customdata1"

:RequestMailBoxInputBox $mailBox "Select mailbox %mailboxes%" $defBox

{check wether the user entered or selected some text.}{if not then jump to the end of the script}CharCount #n $mailBoxIf #n ! 1 Then Endcript

This will allow people to select a default mailbox using the "Script Setup" tab.

Now the caution, if people have selected a portion of the text in the message then that is all that will be saved, all other text in the body will be lost. There are discussions currently underway regarding how to address this in the next major release.

This will allow people to select a default mailbox using the "Script Setup" tab.

Yes, that's an idea. I was doing the Set defBox so that it would always be initialized and I wouldn't get an error.

Michael wrote:Now the caution, if people have selected a portion of the text in the message then that is all that will be saved, all other text in the body will be lost. There are discussions currently underway regarding how to address this in the next major release.

Thanks, for that info. Even though I know about it, it already happened to me...
IMHO, if you call something %message% it should always contain the complete message. If the possibility to just process the select text then introduce a variable %selectedtext% or something similiar.

Michael wrote:Now the caution, if people have selected a portion of the text in the message then that is all that will be saved, all other text in the body will be lost. There are discussions currently underway regarding how to address this in the next major release.

Thanks, for that info. Even though I know about it, it already happened to me...IMHO, if you call something %message% it should always contain the complete message. If the possibility to just process the select text then introduce a variable %selectedtext% or something similiar.

Thanks adi

The problem with doing this at this stage is that it would break existing scripts. It would be much easier to identify the scripts at risk by scanning for the SaveMessage command rather than changing the current functionality of the %Message variable and introducing a %SelectedText variable, if that were done it would be next to impossible to detect which existing scripts needed to be modified to use the %SelectedText variable.

Michael wrote:Now the caution, if people have selected a portion of the text in the message then that is all that will be saved, all other text in the body will be lost. There are discussions currently underway regarding how to address this in the next major release.

Thanks, for that info. Even though I know about it, it already happened to me...IMHO, if you call something %message% it should always contain the complete message. If the possibility to just process the select text then introduce a variable %selectedtext% or something similiar.

Thanks adi

The problem with doing this at this stage is that it would break existing scripts. It would be much easier to identify the scripts at risk by scanning for the SaveMessage command rather than changing the current functionality of the %Message variable and introducing a %SelectedText variable, if that were done it would be next to impossible to detect which existing scripts needed to be modified to use the %SelectedText variable.

That is true. It all depends on, if you want to stay compatible with the current behaviour or not. If the current behaviour is thought of as needed to not brak existing script, a new variable %mail or whatever will have to be introduced, I guess.