MarkB wrote:Ente,
The code I posted is a demonstration of a way to find a line that contains "Email: " but not "xxx@xxxxx.xx". (...) If you want help with that, please post the script here.
For an explanation of $userfile1, see PocoScript Help under "External."
Hello MarkB,
Zurich not only has plenty of sunshine today, but everybody is happy - they learned that my script is - thanks to you - running smoothly now.
Many thanks, Götz
Here it is:
- Code: Select all
External $userdata1 "Choose a character to quote message with:" ">"
External $userdata1 "Choose a character to quote message with:" ">"
External $userdata1 "Choose a character to quote message with:" ">"
{### Reply to Mail from ZVAB with Template
{----------
{v1.2 - 2008.05.04 - Roger Leemann / Götz Perll and
{ the help of MarkB and making use of "Reply with Template"
{----------
{ This script will reply to a message from a saved template
{ Usage: not suitable for automatic use; use only on demand.
{ Initialize user settings: }
External $userdata1 "Choose a character to quote message with:" ">"
External $userfile1 "Create body template" "ZvabStdRpl.txt"
CreateMessage %m
ReadHeader $a Subject %message
AddStrings $subject "Bestätigung der "
AddStrings $subject $a
SetHeader %m Subject $subject
OpenBody $Body $userfile1
ReadHeader $From From %message
{AddTo %m $From}
{ If template file exists load it }
FileExists &F $userfile1
if &F then UseBody
{ Otherwise, use a blank template }
Set $a "MESSAGE BODY TEMPLATE CURRENTLY NOT SET"
AppendBody $a " "
AppendBody $a " "
AppendBody $a "To use this script, please setup a default message body template:"
AppendBody $a " "
AppendBody $a " press F9 to open Filters and Scripts window, then click on Setup Script."
AppendBody $a " From the drop down box select script "Reply with Template"."
AppendBody $a " Click on the Create Body Template button to create a template."
AppendBody $a " When done, just click on File, Save."
goto Edit
:UseBody
set $a $Body
:Edit
ReadBody $b %message
{v1.0 delete certain lines with information that the adresseee shouldn't see
LineCount #i $b
{ Lines are numbered 0..n-1
:FindLoop
Dec #i
If #i < 0 Then ExitFindLoop
GetLine $line #i $b
StringPos #j "E-Mail: " $line
If #j < 1 Then FindLoop
StringPos #j "aaa@aaa-aaa.ch" $line
If #j > 0 Then FindLoop
StringPos #j "bbb@bbb-bbb.ccm" $line
If #j > 0 Then FindLoop
{ At this point, the string $line contains "E-Mail: "
{ and not "aaa@aaa-aaa.ch" or "bbb@bbb-bbb.com"
ChopString $line 1 8
AddTo %m $line
:ExitFindLoop
:DGP
set #ll -1
LocateLine #ll "Bestellung über ZVAB bei:" $b
if #ll > -1 then DL1
goto FL2
:DL1
DeleteLine $b #ll 12
:FL2
set #l -1
LocateLine #ll "Zum Bearbeiten" $b
if #ll > -1 then DL2
goto FL3
:DL2
DeleteLine $b #ll 2
:FL3
set #ll -1
LocateLine #ll "Diese Bestellung wurde" $b
if #ll > -1 then DL3
goto FL4
:DL3
DeleteLine $b #ll 21
:CONT
QuoteBody $b $UserData1
AppendBody $a " "
AppendBody $a $b
AssignBody %m $a
appendsignature %m
EditMessage %m
MarkMessage %message 2
And this is what it does. When I get an email to which I want send an answer but where in FROM: is not the address of the people to which I want to send the mail, it looks in the body for the address to use.
Since in the body is mentioned not only my clients E-Mail address, but also my address (
xxxx@xxx-xxxx.ch) and also the one of the company from which I received the mail (
xxxx@xxx-xxxx.com) the part of the script which starts with
LineCount #i $band ends with
:ExitFindLoopkeeps the script from selecting these two addresses, which are not needed, and selects the one to which I wish to send my confirmation.
Furthermore some standard text in which I say thank you for the order and recomand my own homepage. etc. is entered
with
External $userfile1 "Create body template" "ZvabStdRpl.txt"
And at several place some of the text transmitted from ZVAB to me, which my client does not need to see and/or takes only lots of paper when printed, is deleted with this:
- Code: Select all
:DGP
set #ll -1
LocateLine #ll "Bestellung über ZVAB bei:" $b
if #ll > -1 then DL1
goto FL2
:DL1
DeleteLine $b #ll 12
The last line of the script gives the incoming mail a specific colour to let me know that it has been answered:
MarkMessage %message 2
~ Masked email adresses & added code tags ... Eric ~