[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - AddRawAddress bug confirmation

AddRawAddress bug confirmation

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

AddRawAddress bug confirmation

Postby Michael » Sat Oct 30, 2004 3:41 am

Would someone please confirm the bug I am seeing. The following script will illustrate it:
Code: Select all
{  Append a note to an existing address entry.

Set $Address "Foo Bar <foo@bar.com>"
IsAddressPresent &SW $Address $CurrentAddressBook
If &SW Then Exists
MessageBox "Address does not exist, either add <foo@bar.com> to your address book or edit the script and change the email address in line 3"
:Done
Exit
:Exists
Set $EMail $Address
ExtractEMail $EMail
GetRawAddress $AddressEntry $EMail $CurrentAddressBook
ReadCSV $AddressEntry $AddressEntry
GetLine $Notes 3 $AddressEntry
ReadCSV $Notes $Notes
LineCount #n $Notes
InputBox $Note "New note to append"
If $Note = "" Then Done

WriteCSV $Note $Note
AppendBody $Notes $Note
WriteCSV $Notes $Notes
DeleteLine $AddressEntry 3 1
InsertLine $AddressEntry 3 $Notes

WriteCSV $AddressEntry $AddressEntry
RemoveAddress $CurrentAddressBook $EMail
AddRawAddress $CurrentAddressBook $AddressEntry
Exit


First add address <foo@bar.com> to your current address book, make sure there is one line in the note entry. Then run this script using Debug mode. It appends notes to the note field. The problem is that sometimes Poco will throw an access violation and the address will disappear from the address book. I have found that if I switch address books and return the address reappears. (Both the access violation and the disappearing address are problems but they may be related, solving the access violation may solve the disappearing address problem).
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby Hogyt » Sat Oct 30, 2004 10:31 am

Confirmed. It may be related to RemoveAddress and AddRawAddress both updating the same file and running them too quickly together causes problems. When i put a Wait 1 in between them the errors didn't appear although i only tested it briefly.
Mat
Hogyt
Poco Enthusiast
 
Posts: 241
Joined: Thu Jul 29, 2004 11:22 am
Location: England

Postby Pete » Sat Oct 30, 2004 10:37 am

I also reproduced the problem. I had to run the script more than once before it happened. I received an infinite number of AVs and I had to kill Pocomail.
Pete
 

Postby Pete » Sat Oct 30, 2004 10:42 am

Michael (or Mat), do you think that this problem is new to v3.2?

I use the RemoveAddress/AddRawAddress sequence in one of my scripts, but I only run it occasionally so I hadn't seen this behavior yet.
Pete
 

Postby Hogyt » Sat Oct 30, 2004 11:03 am

Pete, i tried it in 1880 and it seemed to run ok, unless i held down alt+u on the edit script tab to run it really quickly in which case it crashed. Maybe that is a different problem though.
Mat
Hogyt
Poco Enthusiast
 
Posts: 241
Joined: Thu Jul 29, 2004 11:22 am
Location: England

Postby Hogyt » Sat Oct 30, 2004 11:09 am

Having said that it's now crashed in 1880, running the script normally. I didn't have anything in the notes field either but i did have a long company field.
Mat
Hogyt
Poco Enthusiast
 
Posts: 241
Joined: Thu Jul 29, 2004 11:22 am
Location: England

Postby Pete » Sat Oct 30, 2004 11:32 am

I just ran my own script a few times without any problems, but then I realized that my script doesn't do anything with Notes. So if the problem is specific to Notes, then the problem won't affect me (fingers crossed).

Another thought: my script is based on address-book code that (I think) Michael posted in the forums a long time ago. I noticed that the script that Michael just posted uses the WriteCSV command, but I don't have that in my script yet my script has always worked fine. Maybe this has nothing to do with the problem, but FYI, here's the relevant code from my script (note: no WriteCSV command):
Code: Select all
AddAddress $addressbook "John Doe <jd@jd.com>"
GetRawAddress $multiLine "jd@jd.com" $addressbook
ReadCSV $multiLine $multiLine

DeleteLine $multiLine 0 1
InsertLine $multiLine 0 "" { nickname }
DeleteLine $multiLine 1 1
InsertLine $multiLine 1 $displayName
DeleteLine $multiLine 2 1
InsertLine $multiLine 2 $email
DeleteLine $multiLine 5 1
InsertLine $multiLine 5 $firstName
DeleteLine $multiLine 7 1
InsertLine $multiLine 7 $lastName

RemoveAddress $addressbook "jd@jd.com"
AddRawAddress $addressbook $multiLine
Pete
 

Postby Hogyt » Sat Oct 30, 2004 11:50 am

That crashes too Pete :( I tried putting a Wait in and it still crashed :(
Mat
Hogyt
Poco Enthusiast
 
Posts: 241
Joined: Thu Jul 29, 2004 11:22 am
Location: England

Postby Hogyt » Sat Oct 30, 2004 12:09 pm

I got a more revealing error this time: "Cannot create file Address\Test.ini.". Seems like it is definitely related to the address files being accessed too quickly.

Adding a Wait 2 before the AddRawAddress command in both scripts seems to stop it crashing, unless i click on the Run button whilst the script is already running or hold down alt+u.
Mat
Hogyt
Poco Enthusiast
 
Posts: 241
Joined: Thu Jul 29, 2004 11:22 am
Location: England

Postby Michael » Sun Oct 31, 2004 1:15 pm

Thanks for all the testing! I appreciate the hint regarding the wait command. I'll post the information to Bug Traction when I get a moment.

PS: I don't think the bug is restricted to 3.2.
Michael
Moderator
 
Posts: 866
Joined: Mon Jul 26, 2004 12:14 pm
Location: Victoria BC, Canada

Postby SFCurley » Tue Sep 23, 2008 2:27 pm

I'm running the most current version of Poco and a variation of the addrecipient script, which uses the RemoveAddress then the AddRawAddress and I receive this error, too, regardless of whether or not a note is present and even with a wait of 10 between the remove and the add.

Is there any known workaround or other programming construct to avoid this problem?

Thanks
SFCurley
 

Postby SFCurley » Sat Sep 27, 2008 6:12 am

Ok, one answer to my question above -- and the one I ended up using -- is to skip the unnecessary add-to-then-readback of the emailaddress to the address book, before deleting and re-adding it. What I did was to create a one line blank addressitem variable, and then all the lines I wanted to it, per the Poco spec. This prevents the fatal error that I was always getting. Here's the code.

Code: Select all
Set        $addressitem " "
InsertLine $addressitem 1 ""
InsertLine $addressitem 2 $EMailAddress
InsertLine $addressitem 3 $Notes
InsertLine $addressitem 4 ""
InsertLine $addressitem 5 $Firstname
InsertLine $addressitem 6 ""
InsertLine $addressitem 7 $Lastname
InsertLine $addressitem 8 ""
InsertLine $addressitem 9 ""
InsertLine $addressitem 10 ""
InsertLine $addressitem 11 ""
InsertLIne $addressitem 12 $Favourite

AddRawAddress $CurrentAddressBook $AddressItem



Here's the full script, which asks whether or not to add the outgoing email address (if not already in the book), what first and last name to use, and if the "mass mail option" is set to yes, offers the user the option of inputting VIP and Notes fields.

Code: Select all
Set $OnErrorGoTo ErrorHandler

External $MassMail "Offer Mass Mail List Options?" "No"

ImportSettings

ReadHeader $addressItem "To:" %message
IsAddressPresent &present $addressItem
If &present Then Stop

Set $msg ""
AddStrings $msg "Do you want to add " $AddressItem " to your " $CurrentAddressBook " address book?%var%"
InputBox $answer $msg "Yes|No"
LowerCase $answer
If $answer ! "yes" Then Stop

Set $EMailAddress $AddressItem
ExtractEMail $EMailAddress

InputBox $firstname "First Name?" 
Trim $firstname

InputBox $lastname "Last Name?" 
Trim $lastname

Set $favourite "0"
Set $notes ""

LowerCase $MassMail
If $MassMail = "no" Then SkipMassMail

Set $msg ""
AddStrings $msg "Add this address to mass mailing list"?%var%"
InputBox $answer $msg "Yes|No"
LowerCase $answer
Set $favourite 1
If $answer = "yes" Then Skip
Set $favourite 0

:Skip

InputBox $notes "Notes?"
Trim $notes

:SkipMassMail

Set        $addressitem " "
InsertLine $addressitem 1 ""
InsertLine $addressitem 2 $EMailAddress
InsertLine $addressitem 3 $Notes
InsertLine $addressitem 4 ""
InsertLine $addressitem 5 $Firstname
InsertLine $addressitem 6 ""
InsertLine $addressitem 7 $Lastname
InsertLine $addressitem 8 ""
InsertLine $addressitem 9 ""
InsertLine $addressitem 10 ""
InsertLine $addressitem 11 ""
InsertLIne $addressitem 12 $Favourite

AddRawAddress $CurrentAddressBook $AddressItem

Exit

:Stop
Exit

Exit

:ErrorHandler
   MessageBox "Terminating due to fatal error."
Exit



~ Replaced quote tags by code tags ... Eric ~
SFCurley
 

Postby MarkB » Wed Oct 01, 2008 2:21 am

SFCurley,

Just for fun, if you want to, and if you have a fairly recent version of Poco, you could get all your user input through a single dialog.

Code: Select all
# User Input
DialogBox "Clever Title for the Dialog Box" "This is a concise, precise, user-friendly description" "Add to address book%bool%" $addtobook "Add to mail list%bool%" $addtolist "First name" $firstname "Last name" $lastname "Note" $note

# Test feedback
AddStrings $feedback "Address book: " $addtobook "\nMail list: " $addtolist "\nFirst name: " $firstname "\nLast name: " $lastname "\nNote: " $note
MessageBox $feedback
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Postby SFCurley » Wed Oct 01, 2008 2:38 am

Excellent. Thank you for the tip. I will do.
SFCurley
 

Postby MarkB » Wed Oct 01, 2008 4:08 am

Correction post. :oops: The yes/no answers could have been assigned to boolean variables -- doing so produces convenient check boxes in the dialog. Also, an address book can be selected if desired. Thought I'd mention it because there doesn't seem to be much documentation for this useful command. Moderator: I deserve a stern warning about taking the thread off topic.

Code: Select all
# User Input
Set &addtobook 1
Set &addtolist 0
Set $note "Default value"
DialogBox "Clever Title for the Dialog Box" "This is a concise, precise, user-friendly description" "Add to address book%bool%" &addtobook "Add to mail list%bool%" &addtolist "First name" $firstname "Last name" $lastname "Note" $note "Address book%addressbooks%" $addressbook

# Test feedback
AddStrings $feedback "Address book: " &addtobook "\nMail list: " &addtolist "\nFirst name: " $firstname "\nLast name: " $lastname "\nNote: " $note "\nAddress book: " $addressbook
MessageBox $feedback
MarkB
Poco Enthusiast
 
Posts: 217
Joined: Mon Aug 09, 2004 1:31 am
Location: Canada

Next

Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 3 guests

cron