Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - ddddd13

Pages: [1] 2
1
Feature Request / Cloud Storage?
« on: September 19, 2020, 10:49:44 AM »
I am not sure if this is the best way to do what I want. But here it goes.

What I want to do.

An app that runs on a cell phone that allows the user to look at variables, and maybe a reset button. I thought using SimpleWebServer would work for me but that gets very complicated going thru servers.

The next idea is to store these variables in a file in the cloud. The app on the cell phone would simply read these variables and display them. To send information back (not really necessary for my application, but maybe to others)
The advanced HMI solution would read this file back from the cloud.

I really don't like the idea of VPN as the operators could really screw things up.

Do you think this is a viable solutiion?

Dave

2
Support Questions / SimpleWebServer problems
« on: September 10, 2020, 07:01:07 PM »
I am trying to get SimpleWebServer to work. I looked on line and it showed how to diagnose connection problems, with a breakpoint. That is well and good if you are debugging the program, but after you have compiled it and try to run it on a different machine, it is a problem. I tried adding a consolewriteline to the SimpleWebServer code as follows.

        Dim LocalComputerName As String = System.Net.Dns.GetHostName() '* same as My.Computer.Name
        Dim localAddr As System.Net.IPAddress = GetIPv4Address(LocalComputerName)

        Console.WriteLine("address ", localAddr)
       
 If localAddr Is Nothing Then
            localAddr = System.Net.IPAddress.Parse("127.0.0.1")
        End If

But I never see anything. I have also tried.

Mainform.RichTextbox3.text=("address ", localAddr)

That gives me errors. Any ideas?

Dave

3
Feature Request / Expanded SimpleWebServer
« on: September 08, 2020, 08:56:10 PM »
Simple Web Server seems able to send information in one direction (the page it is displaying) It would be nice to be able to send information back to the HMI. I understand this would require some kind of security also.

Thanks,
Dave

4
Support Questions / How to change emailer settings
« on: September 03, 2020, 08:24:09 PM »
When using the emailer it will send out an email on startup if I use the TriggerType ValueChange. This is the easiest way for me to send an email as all I have to do is increment value. I have tried
Emailer1.TriggerType=ValueChange
and
Emailer1.TriggerType = AdvancedHMI.Controls.EmailerEx.TriggerTypeEnum.ValueChange
Neither one actually changes the Type.

What am I doing wrong

Dave

5
Support Questions / Message Handler
« on: August 31, 2020, 10:07:23 PM »
I am trying to run a very simple program to test sending messages. I want to send a message to an email to confirm it works, then to a phone number. I have set a momentary push button on the main screen that increments the messagehandler1.value variable. I expect this to send an email as the property is set to send the email on change of value. When running the program under debug it gives an alarm com component not set. What am I doing wrong?

6
Support Questions / Emailer to cell phone
« on: August 24, 2020, 01:22:20 PM »
The emailer works but when trying to send an email to the cell phone it does not. Doing an on line search I should be able to enter the phone number followed by @vtext.com or @vzwpix.com However these no longer work and an online search states that. Have you any experience in sending email to a cell phone?

Thanks,
Dave

7
Support Questions / MessageHandler not quite right
« on: February 06, 2020, 11:43:20 PM »
It worked for several months, now it does funny things.

The first email works perfect. It sends all three emails as it is supposed to. The one curiosity it logs errors

No File Specified for alarms, emails, and timeouts.
No File Specified for email address list.
No File Specified for alarms, emails, and timeouts.
No File Specified for email address list.

These alarms are logged on the first email and never again. I have two files called emails and emailer and they are entered in the message handler properties. (C:\Files\Emails and C:\Files\Emailer) something like this.
C:\Files\Emailer
1,1,10,2,10,3

C:\Files\Emails
1,AJ.IT@apcorp.com
2,RS.IT@apcorp.com
3,DS.IT@apcorp.com

Everything would be ok except when the second set of emails is sent. It should go to the first on the list wait 10minutes, send to the 2nd on the list, wait 10 minutes, and send to the 3rd. Instead it just sends one email to the third on the list.

Any ideas?

8
Support Questions / Show and Hide
« on: October 03, 2019, 06:22:11 PM »
I am running an app with basically three forms. The first form (MainForm) does  a line of code
operator_reports.Show()
That is the 3rd form. After .5 seconds it does another line of code.
operator_reports.Hide()
That all works fine, and I can see the form display and then go away. Now I change to the second form (Parameters)
It has a button on it that runs a routine as follows.
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Hide()
        operator_reports.Show()

    End Sub

When this button is clicked it goes to the operator_reports screen for a second then bombs out back to visual studio. The program is still running but the forms are not displayed? If I remove the Me.Hide() from the above it will go to operator_reports for a second and then right back to the parameter form. Any suggestions?

9
Support Questions / Pc to Pc communications
« on: August 14, 2019, 10:36:05 AM »
Can I set up AdvancedHMI running on one PC to communicate to another PC running AdvancedHMI via ModbusTCP. I need to transmit a few bytes from one computer to another (but not back). It seems Modbus would be the easiest way to achieve this. Currently I am writing a file over a network but I get a lot of errors because of the conflicts involved with one computer reading while the other is writing. Or do you have a better suggestion?

Thanks,
Dave

10
Support Questions / Message Handler quit working
« on: August 05, 2019, 06:43:59 PM »
Archie;

It used to work. I have attached the event and error logs for emailsrvr.com


11
Support Questions / Form Load Missing from toolbox
« on: July 31, 2019, 05:12:24 PM »
Archie;

In digging a little deeper. I found the topic on erasing the obj and bin files. I did that and there is not a sou file. I still get the same results. However, I did notice the form change button no longer exists in the toolbox.

Dead in the water.
Dave

12
Support Questions / VS Does it again!
« on: July 31, 2019, 02:01:57 PM »
Archie;

VS has done it to me again. I have saved 4 or 5 copies of this program but it names it, as it likes, and it causes it to write a bad program into all of them!!!

When I try to open the main form I get an alarm "cannot process the alarm at line 35:MeBasicLabel=New AdvancedHMIControls.BasicLabel() The code within the method 'InitializeComponent is generated by the designer and should not be manually modified.

When trying to open other forms I get more errors. Such as.

Could not find type MFGControl.AdvancedHMI.FormChangeButton. Please make sure that the assembly that contains this type is referenced.

and

The variable FormChangeButton2 is either undeclared or was never assigned.

I have cleaned the project cleaned advanced HMI, closed VS and reopened, still the same alarms.

Why does this keep doing it to me, and how can I save the program under a different name that won't clobber any other program?

Thanks,
Dave

13
Support Questions / File decoder slowing down?
« on: July 13, 2019, 10:37:24 AM »
The following is code to open the oldest file, decode it, save it, and move the original file to a new directory every 4 seconds. It works great, except!

When decoding a large amount of files it slows down. Dramatically! I added the EpicorData() clear to clean out the List of String, and that helped a lot. I am also using other lists of string but do not want to clean them out every time.

I noticed when I went to look at the directory with file explore it would suddenly decode every 4 seconds again. This was happening because the form Visible routine was being run from the beginning cleaning things out, I think!

So I decided to add another form that I will call every 20th file read. That would close the main form and open form3.
When form 3 was active or visible it would close form 3 and reopen the Main form. I found a routine on the forum

If Myform isnot nothing then
Myform=new form3
end if
Myform.Show

My question is. Don't I have to close the form I am on? If the above code is in the Main form then the following should be in the form3 visible routine?

If Myform isnot nothing then
Myform=Main form
end if
Myform.show

Thanks,
Dave
Imports System.Net
Imports System.Net.Security

Imports System.IO

Public Class MainForm

    Dim Machine As String
    'Dim Employee As String
    Dim file As String
    Dim EMPLOYEES As New List(Of String)
    Dim MACHINENUM As New List(Of String)
    Dim parameter As New List(Of String)
    Dim EpicorData As New List(Of String)
    Dim LenOfDir As New List(Of Integer)
    Dim FtpAddress As String
    Dim FtpUserName As String
    Dim FtpPassword As String
    Dim FtpFileName As String



    '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    '* Copy this section of code to every new form created
    '*******************************************************************************
    Private NotFirstShow As Boolean

    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        '* Do not start comms on first show in case it was set to disable in design mode
        If NotFirstShow Then
            AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
        Else
            NotFirstShow = True
        End If
    End Sub

    '***************************************************************
    '* .NET does not close hidden forms, so do it here
    '* to make sure forms are disposed and drivers close
    '***************************************************************
    Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        Dim index As Integer
        While index < My.Application.OpenForms.Count
            If My.Application.OpenForms(index) IsNot Me Then
                My.Application.OpenForms(index).Close()
            End If
            index += 1
        End While
    End Sub
    Private Sub MainForm_Activated(sender As Object, e As EventArgs) Handles MyBase.Activated
        'setup length of file variables
        Debug.WriteLine("Activated")
        For i = 0 To 31
            LenOfDir.Insert(i, 0)
        Next i
        'read parameters to find ftp address ect.
        Using sr As New System.IO.StreamReader("C:/fILES/EpicParm.txt")
            While Not sr.EndOfStream
                parameter.Add(sr.ReadLine())
            End While
        End Using
        TextBox1.Text = parameter(1)
        'read EMPLOYEES to MATCH NUMBER TO NAME
        Using sr As New System.IO.StreamReader("C:/files/EMPLOYEEs.TXT")
            While Not sr.EndOfStream
                EMPLOYEES.Add(sr.ReadLine())
            End While
        End Using
        'read MACHINE to MATCH NUMBER TO NAME
        Using sr As New System.IO.StreamReader("C:/files/MACHINE.TXT")
            While Not sr.EndOfStream
                MACHINENUM.Add(sr.ReadLine())
            End While
        End Using

        RichTextBox1.Text = MACHINENUM.Count

        FtpAddress = parameter(0)
        FtpUserName = parameter(1)
        FtpPassword = parameter(2)
        ' RichTextBox1.Text = FtpAddress & Chr(13) & FtpUserName & Chr(13) & FtpPassword & Chr(13) & parameter(3) & Chr(13) & parameter(4) & Chr(13) & parameter(5)
    End Sub


    Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        ' Timer1.Enabled = True
        Timer2.Enabled = True
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        Dim LineCount As Integer = 0
        Dim fileCount As Integer = IO.Directory.GetFiles("C:\Epicor_Programs", "*.*").Length
        'if a file exists decode it
        If fileCount > 0 Then
            EpicorData.Clear()
            'get the directory and display in text box 4
            Dim files() As String = IO.Directory.GetFiles("c:\Epicor_Programs")
            RichTextBox4.Text = files(0)

            'read the oldest FILE TO FIND MACHINE INFO FROM EPICOR
            Using sr As New System.IO.StreamReader(files(0))
                TextBox3.Text = (files(0))
                While Not sr.EndOfStream
                    EpicorData.Add(sr.ReadLine())
                    TextBox3.Text = TextBox3.Text + (LineCount.ToString) & (vbCrLf)
                End While
            End Using

            'convert epicor data into single strings
            For i = 0 To EpicorData.Count - 1
                RichTextBox6.Text = (EpicorData(i))
                RichTextBox5.Text = RichTextBox6.Text.Replace(",", vbCrLf)

                'find employee number and match it to name
                'Then reinsert it into textbox 5 for saving to file
                For j = 0 To (EMPLOYEES.Count - 1)
                    RichTextBox1.Text = RichTextBox1.Text + EMPLOYEES(j).Substring(0, 4) & (vbCrLf)
                    If EMPLOYEES(j).Substring(0, 4) = RichTextBox5.Lines(0) Then
                        Dim lines() As String = Me.RichTextBox5.Lines
                        lines(0) = EMPLOYEES(j)
                        Me.RichTextBox5.Lines = lines
                    End If
                Next j

                'find MACHINE NAME and match it to number
                'Then reinsert it into textbox 5 for saving to file
                Dim Machines2() As String
                For k = 0 To (MACHINENUM.Count - 1)


                    Machines2 = MACHINENUM(k).Split(",")
                    RichTextBox2.Text = RichTextBox2.Text + Machines2(0) & (vbCrLf)
                    If Machines2(0) = RichTextBox5.Lines(1) Then
                        Dim lines() As String = Me.RichTextBox5.Lines
                        lines(1) = MACHINENUM(k)
                        Me.RichTextBox5.Lines = lines
                    End If
                Next k

                ' Write decoded data to file with machine number for name
                Machine = RichTextBox5.Lines(1)
                TextBox3.Text = Machine
                'Check if data exists in machine string
                If Machine.Length > 2 Then
                    Machine = Machine.Substring(Machine.Length - 3)
                End If
                'If it doesnt have a machine number asign it noname
                If Machine.Length < 1 Then
                    Machine = "noname"
                End If
                Dim strWrite As New StreamWriter("C:\MachineData\" & Machine & ".txt")

                For Each line As String In RichTextBox5.Lines
                    strWrite.WriteLine(line)
                Next

                strWrite.Close()
            Next i

            'GET THE FILENAME AND COPY IT TO EPICOR PROGRAM OLD DIRECTORY
            Dim file2 As String
            file = RichTextBox4.Lines(0)
            file2 = file.Substring(file.Length - 34)
            TextBox1.Text = file
            My.Computer.FileSystem.MoveFile(file, "C:\Epicor_Programs_Old\" & file2)
         
        End If

    End Sub


End Class

14
Support Questions / VS Debugger and List of Strings
« on: July 09, 2019, 08:10:28 AM »
Archie;

VS Debugger was closing and reopening when trying to debug. It would close the window after 18seconds and then reopen. Scary! Now it quit. Any ideas?

Also, it seems I can only have one list of strings in a Sub or solution. Can you shed any light on this, or point me to a link?

Thanks,
Dave

15
Support Questions / FTP Certificates
« on: June 21, 2019, 07:51:23 PM »
Archie;

The code you wrote to read the FTP site worked great. But now they turned on the certificates and I get alarms stating that. The following is the code you wrote and the 5 lines I removed the ' from. With that I get a alarm, CertLocation is not declared. I tried DIM CertLocation as String and it returns an alarm text is not a string.   


 Private Sub FtpRead_Tomorrow()
        'GET TODAYS DIRECTORY
        'LOAD EPICOR DATA
        ' Get the object used to communicate with the server.

         Dim request As Net.FtpWebRequest = DirectCast(WebRequest.Create(FtpAddress & Tomorrow & "*.*"), FtpWebRequest)
     
     
        request.Method = WebRequestMethods.Ftp.ListDirectoryDetails
        'THE FOLLOWING 5 LINES WILL NEED TO BE TURNED ON IF CERTIFICATES ARE REQUIRED
        request.EnableSsl = True
        Dim cert As X509Certificate = X509Certificate.CreateFromCertFile(CertLocation.Text)
        Dim certCollection As X509CertificateCollection = New X509CertificateCollection()
        certCollection.Add(cert)
        request.ClientCertificates = certCollection
        ' This example assumes the FTP site uses anonymous logon.
        request.Credentials = New NetworkCredential(FtpUserName, FtpPassword)
        Using response As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse)
            Dim responseStream As IO.Stream = response.GetResponseStream()
            Using reader As New IO.StreamReader(responseStream)
                RichTextBox1.Text = (reader.ReadToEnd())

            End Using
        End Using



    End Sub
with that I get a alarm, CertLocation is not declared. I tried DIM CertLocation as String and it returns an alarm text is not a string.

Will this code handle certificates?

Thanks,
Dave


Pages: [1] 2