Recent Posts

Pages: [1] 2 3 ... 10
1
So I tried using the NativeMethods.VB from the link that was given which fixed the "Friend" issue. However now its throwing an exception saying:
Code: [Select]
MfgControl.AdvancedHMI.NativeMethods::OpenPrinter' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'
Which I have no idea what that means...
3
I have plugged everything in, but I am getting an error for the NativeMethods portion.

It is showing that the method isn't accessible because it is a "Friend" though the whole sub is public and its namespace is being imported.

And is the .pDocName suppose to be the name of the format file?
4
Support Questions / Re: AdvancedHMI not correct .NET framework for nugget.
« Last post by Archie on May 09, 2024, 06:39:53 PM »
The RawPrinterHelper.vb file is added to the project by right clicking the AdancedHMI project and selecting Add->Existing Item.

You are correct, the printer name does not matter as long as it is default.
5
Support Questions / Re: AdvancedHMI not correct .NET framework for nugget.
« Last post by paintman on May 09, 2024, 02:24:29 PM »
Okay that seems fairly simple. The rawprinterhelper is a tad confusing for me.

Is the rawprinterhelper just placed in a separate module and called when needed? I am looking at the class and trying to understand some segments of the code. 
Would I just change this to what ever I name the ZPL file as, and the data type I assume would remain the same since its send a direct ZPL file?
Code: [Select]
        ' Set up the DOCINFO structure.
        With di
            .pDocName = "Mix Room Label Printer"
            .pDataType = "RAW"
        End With

And as far as the printer name goes, I figure it wouldn't really matter as long as it is the default.
6
Open Discussion / Wago Modbus
« Last post by smoreno on May 09, 2024, 12:26:47 PM »
Hello
I am new this software, I think it works good,
I have some isseu addressing modbus to wago plc, has some one done any communication on this brand
tha can help out,
thanks in advance
7
Support Questions / Re: AdvancedHMI not correct .NET framework for nugget.
« Last post by Archie on May 09, 2024, 10:01:40 AM »
After creating the file using the Zebra designer software, I manually edited with Notepad. Attached is the file.

The first thing my code does is to read data from the PLC and put it in a local variable:
Code: [Select]
        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

It then reads the file and stores it in a string:
Code: [Select]
        Dim s As String
        Using sw As New System.IO.StreamReader("BatchTicketLabelFormat.prn")
            s = sw.ReadToEnd()
        End Using

Using Regular Expression, the string is parsed looking for the brackets
Code: [Select]
        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

And finally send the string directly to the printr:
Code: [Select]
        RawPrinterHelper.SendStringToPrinter(RawPrinterHelper.DefaultPrinterName(), s)
8
Support Questions / Re: AdvancedHMI not correct .NET framework for nugget.
« Last post by paintman on May 09, 2024, 09:34:02 AM »
I think I found a thread on plctalk refering to the project you mentioned. It said you used brackets [] as the container to look for in the zpl, but how did you get the bracket in to the file? Did you just prefill the text with [Variable] and then just replaced the inner string, or you just altered the actual zpl file?

I am very interested on seeing the code for this, I am not well versed on printer communications nor how I can link it to AHMI
9
Support Questions / Re: Graphic indicator
« Last post by Archie on May 08, 2024, 05:36:24 PM »
This should work. What version of AdvancedHMI are you using?
10
Support Questions / Re: Exit Button on MainMenu
« Last post by Archie on May 08, 2024, 05:35:32 PM »
You are correct, the MainMenu does need to use MainMenuButtons instead of form change buttons.

The MainMenu form has a property of MenuPosition. Depending on whether the form is taller than wide or vice versa is what determines the edge it will dock to.
Pages: [1] 2 3 ... 10