AdvancedHMI Software
General Category => Support Questions => Topic started by: ddddd13 on June 15, 2019, 08:48:19 AM
-
Archie;
I cannot remember how the Message Handler works. I know I need to enter the SMPT info, but what calls the message handler itself. Example, I have a button called send message. How does that run the message handler. Also there is a variable in the property called Value. Is that the # in the emailer that will be used? Example 5 would use the fifth line in the file which has the number of the person to email, the time to wait, the number of the second person to email, the time to wait, and the number of the third person to email.
Thanks,
Dave
-
The value indicates the message number and a change in value will initiate sending an email as defined in the AlarmToEmail.txt
The first digit in AlarmToEmail.txt indicates the message number
-
Archie;
I assume the following is what you mean by changing the value. Keep in mind it starts with 0
MessageHandler1.Value = 1
It does not work. We tested MessageHandlerPLC I don't remember if we tested MessageHandler.
I have tried sending from three different email servers including yours.
Any more ideas?
Dave
-
- Set EnableEventLogging to True
- Run the Application
- Post the contents of ErrorLog.txt and EventLog.txt
-
VS SUCKS!!!!
Why do they think they are better at deciding when and what to save. They Crashed another form. If I was able to save it when I wanted to and not have to worry about them overwritting I could simply go back to the last copy and start over without having to redesign the entire form. How %&*#@
stupid.
Dave
-
Any time you run the application Visual Studio will save all the files, so you will at least have up until the last time you ran the application.
-
Now I have a blank form. On this page is supposed to be 48 radio buttons. if I try to load a radio button from the tool box it labels it radio button 49. How can I delete the form to get rid everything associated with the form and start over?
Dave
-
- Windows -> Close All Documents
- Close Visual Studio
- Re-open the project in VS
- Build->Rebuild Solution
- In Solution Explorer double click the form you want to open
-
I did one better I rebooted restarted VS and loaded operator reports. Blank Screen. The code is there yet but the controls are not on the screen.
Dave
-
With VS 2019, it is important to close all document because it has a startup bug when a design view is open.
In VS2019, "Reopen documents on solution load" is actually a good option to uncheck (Found in Tools->Options->Projects and Solutions):
-
How do I now get rid of that form to start over.
Dave
-
If you are sure you want to completely delete it with no recovery possible, then right click it in Solution Explorer and select Delete
-
I did as you suggested now I have a copy of the correct form in the second solution. But again I cannot right click and click use existing as the form operator reports.vb[Design] or any form with [Design] are not found. In other words how do I get that back to the first solution that has the corrupted designer form?
Dave
-
In the second solution in Solution Explorer, right click AdvancedHMI project and select Open Folder in File Explorer.
Do you then see these 2 files?
OperatorReports.designer.vb
OperatorReports.vb
-
yes
-
I copied them over and now I get a bunch of errors form change button undeclared ect ect ect These are left over from the last form I am sure.
Dave
-
- Open your first solution in Visual Studio
- In Solution Explorer right click AdvancedHMI and select Add->Existing Item
- Browse to the folder where you saw the 2 files
- Select the OperatorReports.vb and click the Add button
- It may ask to replace files 2 or 3 times, click Yes each time
-
Check to see if both solutions use the same version of AdvancedHMI
- Open your first solution
- In Solution Explorer, right click the AdvancedHMI project and select Properties
- In the Application Tab click the Assembly Information button
- Make note of the Assembly Version
- Repeat this for the second solution
Do they match?
-
I finally got it all straightened out. It is hard to tell but I think if I stop the program with a value other than 0 MessageHandler1.Value It corrupts the program. If I make sure the value is 0 before ending it does not crash. Does that make sense? Moving on!
The attached is the error log using excite and gmail emails. I have tried using yours but it seems to have been turned off. Excite rejects the connection all together. gmail reports unrecognized command even with the wrong address.
Can you recommend a email provider?
Thanks,
Dave
-
Getting the public email servers to relay email from an application can sometimes be tricky. They usually have precautions in place to keep spam bots from flooding their servers. For me Gmail has been the most difficult because of their tight security.
For excite it looks like the SMTPserver is smtp.excite.com
SMTPLoginUserName is your email address
SMTPLoginPassword is your email password
SMTP port 465
One place did say UseSSL must be true.
-
Archie;
I could not get gmail to work. I tried mail.com and it would send about 50% of the e-mails however, now it won't send any it just comes back with mailbox unavailable.
But now I have the form eater problem coming back in. I get the alarm. The designer can not process the code at line 77: Me.MessageHandler1=new AdvancedHMIControls.MessageHandler() The code within the method 'Initialize Component' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.
I have not changed this code and the only thing I write to is MessageHandler1.Value= (0 when I exit 1 when I click a button) Setting it to 0 on exit has prevented this problem all morning but now it is back. I can do a clean I can exit and start again but it will give me the same error. I have learned and saved a copy without the error to a different directory and can just copy that version over the top of the one with the error. But this has always been a problem for me. If I press the ignore and continue it will eat the form!
Thanks
Dave
-
Did you try
- Windows->Close All Documents
- Exit Visual Studio
- Re-open Visual Studio
- Build->Rebuild Solution
-
If you had mail.com work initially then stop, my guess is that you reached the daily limit of outgoing relays.
-
Archie;
Remember I have rebooted the computer! Once that file gets corrupted you dead, dead, dead! You need to erase it and copy a previously saved version into its place.
Daily limit of emails? What do you mean to send thru advanced hmi or the email server. I am now trying fastmail.com and am getting different errors. Look at the attachment. Pay attention to the time. It shows an email attempt every 2 minutes yet in the emailer file it should be emailing every minute???
Dave
-
The error log
-
Remember I have rebooted the computer! Once that file gets corrupted you dead, dead, dead! You need to erase it and copy a previously saved version into its place.
Daily limit of emails? What do you mean to send thru advanced hmi or the email server. I am now trying fastmail.com and am getting different errors. Look at the attachment. Pay attention to the time. It shows an email attempt every 2 minutes yet in the emailer file it should be emailing every minute???
Even if you reboot the PC, it will not fix it. The most important step is to do the Windows->Close All Documents. Otherwise VS just re-opens into the same error. This is a known issue with VS2019 and I see it on a daily basis, but I have never "lost" a form.
The daily limit is set by the hosting email server. I have not been able to find the limit set by mail.com , but this web site will give you a general idea of limits that providers set:
https://docs.mailpoet.com/article/49-lists-of-hosts-and-their-sending-limits
-
Can you attach your AlarmToEmail.txt file?
-
Archie;
I changed from fastmail back to mail. I got 5 emails to send the sixth did not go thru. The following is the error I am getting in the log.
6/17/2019 3:38:58 PM - Send Message : This operation cannot be performed while a message is being sent.
6/17/2019 3:38:58 PM - An asynchronous call is already in progress. It must be completed or canceled before you can call this method.
6/17/2019 3:38:58 PM - System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was:
at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
at System.Net.Mail.SmtpTransport.EndGetConnection(IAsyncResult result)
at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)
Is this the Message Handler thinking it is not complete?
Attached is the emailer file.
-
It's trying to send the next email before the last was completed. The easiest fix is to use a synchronous send.
- In Solution Explorer, right click MessageHandler.vb and select View Code
- Go to line 288 and look for "Client.SendAsync(mm, Nothing)"
- Change that line to
Client.Send(mm)
-
Archie;
it was on line 286 and I changed it but I get the alarm mailbox unavailable. I looked at mail.com and they claim they do not limit the number or size of emails but they do limit what they might consider spam. These emails all look the same and they may consider them spam. I will wait a couple of hours and try again. If it works my problem is solved.
At this point do you suggest putting 286 back to the way it was.
Dave
-
Post the MessageHandler.vb file you currently have and I will have to modify it to handle faster value changes.
-
Archie;
I don't think that is the problem. Making the changes you suggested to line *86 didn't work. I set MessageHandler1.value to 1 with the click of a button. When I leave the form (by clicking a form change button)I have the value being set back to 0. It will not change forms with line*86 that way.
The MessageHandler is being overrun because the server either the xmiter or the receiver locks it out for four hours. I have tested this and after 4 hours I can send 5 emails no more. I have changed the size of the emails by changing the text in the message and heading. I also waited 5 minutes between sending the emails. It still locks it out at 5 emails every 4 hours. This should not be a problem as they will have their own email server and should be able to set it up to allow more emails than 5. I have tried changing the username to see if it would accept another email but it will not until the 4 the hour as it is still the same server.
With all that said I have a couple of other questions.
Can I run more than one message handler at a time?
Can I run the Messagehandler and MessageHandlerPLC at the same time?
I noticed a variable in the messageHandler called acknowledge, what is this?
Is there feedback telling when the messagehandler is complete?
Is there a way to interrupt the MessageHandler i.e. set MessageHandler.Value to 0 and it stops?
Thanks again,
Dave
PS Did you get a price and invoice on the fanless PCs?
-
I need to re-think and rework the message handler because as-is it can only handle processing one message at a time. If one was initiated, then another alarm occurs before all 3 emails were sent from the first, it will not complete the 3 from the first. I need to set it up to queue alarms and handle unlimited simultaneous active alarms.
The Acknowledge property is used to stop any further emails from being sent for the current alarm.
You can use MessageHandler and MessageHandlerPLC at the same time.
-
Archie;
Attached is the message handler
Dave
-
Archie;
Very peculiar!
I am using mail.com to send a message to excite.com it is now locked out for another 3 hours with advanced hmi. However, I can send a email from my laptop using mail.com sending it to excite.com and it works?
That's a head scratcher!!!
Dave
-
Archie:
I added a second Message Handler and a second button to launch it. I ran the first message handler waited 10 seconds and then ran the 2nd. They both sent their messages however they alarmed out after 5 messages.
The point. I think designing a message handler to accept an unlimited number of emails is a big job and overkill for what we need to do. From what I can see in the code the only real problem would be in recording the events and alarms.
I could copy the message handler and rename it to messagehandlerA,B, and C. 3 of them. Change the code to open event log A,B,C and alarm log A,B,C. Then the only thing I would need is feedback to tell me when the message handler is complete. From there it would be easy to select an available handler for the next email.
What do you think?
Dave
-
I completely revamped the MessageHandler to use independent timers for each message, run multithreaded, and use a queue for email sending. This gets around the problems related to the message handler. I will post the code later this morning after I do a little more testing.
-
Archie;
I just tested using two message handlers again this morning it worked fine to 5 emails.
But if you already did a new one, wow! It will be interesting to see how you handled the multi thread problem.
Thanks,
Dave
-
This version has major changes, so I'm sure there will need to be some debugging. But overall it is much more robust.
- Download the attached file
- Unzip the file
- Open you project in Visual Studio
- Right click the AdvancedHMI project and select Add->Existing item (if these files were put in a folder, you will need to right click the folder.
- Browse to and select all of the files the were extracted
- Make sure it asks you to replace existing files (if not they are not replacing the old ones)
- Rebuild Solution
-
Archie;
This is scary! I did what you instructed, and got the following error on rebuild.
'Count' is not a member of 'String()'.
8 times.
I do not see count in the property box but will dig deeper.
Dave
-
Archie;
I also got this one.
Severity Code Description Project File Line Suppression State
Error Could not copy the file "obj\Debug\AdvancedHMICS.exe" because it was not found. AdvancedHMIcs
Dave
-
Archie;
I did something wrong the message handler code is the same as the old one, or the old one no longer exists? I don't know.
Dave
-
Archie;
This is scary! I did what you instructed, and got the following error on rebuild.
'Count' is not a member of 'String()'.
8 times.
I do not see count in the property box but will dig deeper.
If you double click on the error, what line of code does it take you to?
-
Try changing Count to Length or use the attached files.
-
Godra is correct. Any error that goes to ".count" should be changed to ".length"
Arrays should use the Length property, but I tend to use Count out of habit. For a reason that I cannot explain, it compiles with no errors on my PC, but often not on others.
-
Archie;
I am in the field today. I will look at it tomorrow.
Thanks,
Dave
-
Dear Sirs;
Funny I was able to do this before? I am stuck on your instructions of how to install the new message handler.
Right Click on AdvancedHMI project click add existing.
I can't seem to find it.
Thanks,
Dave
-
You can also click once on the AdvancedHMI project in Solution Explorer and Ctrl-Alt-A
If the current MessageHandlers are in a sub-folder, be sure to click on the folder. Otherwise you will get 2 copies and generated a slew of errors.
-
Archie;
On the email form I have messagehandler1 and 2 these 2 where developed with the old messagehandler. After adding existing from the messagehandler download. (It did ask me to replace files). I added messagehandler4 I will send a pic of the properties window to your phone.
Attached is the error and event files. The 8:04 email was sent and received! This was using the old message handler. The others where not received, maybe not sent using the new message handler.
Thanks,
Dave
-
Archie;
Ok I erased messagehandler 1 and 2 from the form. I did the add to existing and loaded the six files unzipped in the folder. Added messagehandler1 to the form and tried it. It worked! No error log 1 message sent in the event log and 1 message received.
I am now at my 5 email limit, so I will have to wait 4 hours before I can test it more.
You talked about a multi thread emailer. Right now I am setting 1 to value, I assume setting it to two will now send the email to what is in the emailer file 2nd on the list. If it was at 1 and I change it to two will it finish out the emails from one? And does acknowledge still interrupt it? If so how does it know to interrupt 1 or 2?
Thanks,
Dave
-
You talked about a multi thread emailer. Right now I am setting 1 to value, I assume setting it to two will now send the email to what is in the emailer file 2nd on the list. If it was at 1 and I change it to two will it finish out the emails from one? And does acknowledge still interrupt it? If so how does it know to interrupt 1 or 2?
Yes, it will send to the recipient for message 2 while continuing to send for message 1. Setting Acknowledge will stop all messages from sending further emails.
-
Archie;
I setup a button that increments the value of Messaghandler1.Value by 1.
When I run the program, I press the button wait 15 seconds, press it again, wait another 15 seconds press it again.
I should get emails from alarm1, then alarm 2, then alarm 3, then alarm 1, then alarm2, then alarm3, then alarm1, then alarm2, then alarm3.
It seems the last alarm turns off the others as I get an email from alarm1, then alarm2, then alarm3, then alarm3, then alarm3.
Thanks,
Dave
-
Can you post your AlarmToEmail.txt file so I can test with the same thing.
-
Archie;
Here it is.
Dave
-
I did find one minor bug:
- In Solution Explorer right click MessageHandler.vb and select View Code
- Go to Line 306 and change m_Value to mm.Subject
sw.WriteLine(Now() & " : (1.1)Email attempt for alarm " & mm.Subject & ", to : " & mm.To.ToString)
-
After I made the correction to make the EventLog.txt report correctly, I ran a similar test. I set Value to 1, wait 10 seconds, set Value to 2, wait 10 seconds and set Value to 3
This is my event log:
6/21/2019 3:53:18 PM : (1.1)Email attempt for alarm Machine : Alarm =1 - 6/21/2019 3:53:15 PM, to :
6/21/2019 3:53:31 PM : (1.1)Email attempt for alarm Machine : Alarm =2 - 6/21/2019 3:53:24 PM, to :
6/21/2019 3:53:37 PM : (1.1)Email attempt for alarm Machine : Alarm =3 - 6/21/2019 3:53:34 PM, to :
6/21/2019 3:54:18 PM : (1.1)Email attempt for alarm Machine : Alarm =1 - 6/21/2019 3:54:15 PM, to :
6/21/2019 3:54:27 PM : (1.1)Email attempt for alarm Machine : Alarm =2 - 6/21/2019 3:54:24 PM, to :
6/21/2019 3:54:37 PM : (1.1)Email attempt for alarm Machine : Alarm =3 - 6/21/2019 3:54:34 PM, to :
6/21/2019 3:55:18 PM : (1.1)Email attempt for alarm Machine : Alarm =1 - 6/21/2019 3:55:15 PM, to :
6/21/2019 3:55:31 PM : (1.1)Email attempt for alarm Machine : Alarm =2 - 6/21/2019 3:55:24 PM, to :
6/21/2019 3:55:37 PM : (1.1)Email attempt for alarm Machine : Alarm =3 - 6/21/2019 3:55:34 PM, to :
-
Hello,
I would like to make error log file data by "MessageListByItem".
Can it be used for this MessageHandler.vb?
Best regards,
Taka