1
Support Questions / Re: AdvancedHMI not correct .NET framework for nugget.
« Last post by bachphi on Today at 09:07:48 AM »See if it will help: https://www.advancedhmi.com/forum/index.php?topic=2209.msg12744#msg12744
' Set up the DOCINFO structure.
With di
.pDocName = "Mix Room Label Printer"
.pDataType = "RAW"
End With
Dim RecipeName As String = ""
Try
RecipeName = EthernetIPforCLXCom1.Read("Batch1RecipeName")
Catch ex As Exception
MsgBox("Failed to read Batch1RecipeName from PLC. " & ex.Message)
Exit Sub
End Try
Dim s As String
Using sw As New System.IO.StreamReader("BatchTicketLabelFormat.prn")
s = sw.ReadToEnd()
End Using
Dim x As System.Text.RegularExpressions.Match = System.Text.RegularExpressions.Regex.Match(s, "\[(.*?)\]")
Dim Substitue As String
While Not String.IsNullOrEmpty(x.Value)
If x.Value.IndexOf("Batch1RecipeName") >= 0 Then
Substitue = RecipeName
Else
Substitue = "ZZZZZZ"
End If
s = s.Substring(0, x.Index) & Substitue & s.Substring(x.Index + x.Length)
x = System.Text.RegularExpressions.Regex.Match(s, "\[(.*?)\]")
End While
RawPrinterHelper.SendStringToPrinter(RawPrinterHelper.DefaultPrinterName(), s)