Hello Guest it is March 28, 2024, 04:34:38 AM

Author Topic: 2 lines of "VB" message to show  (Read 3273 times)

0 Members and 1 Guest are viewing this topic.

2 lines of "VB" message to show
« on: June 17, 2019, 01:27:17 AM »
We are designing a screenset for a customer and would like to show more than 1 line of VB messages from LastErrors.txt file.
Just wondering if it's possible and how do we change the format of the Error label for it to display 2 lines of messages.

Thank you in advance.

Online TPS

*
  •  2,501 2,501
    • View Profile
Re: 2 lines of "VB" message to show
« Reply #1 on: June 17, 2019, 03:36:35 AM »
don't know a possibility to Show more than one line in Standard errorlabel.

but you can run a small code in macropump and Show Messages N and N-1 in two userlabels

Code: [Select]
Open "C:\Mach3\Lasterrors.txt" For Input As #2 ' Open to read file.
Do While Not EOF(2)
Line Input #2, FileData ' Read a line of data.
SetUserLabel(151,GetUserlabel(150)) ' save message N-1 to userlabel151
SetUserLabel(150,FileData)                ' save message N   to userlabel150
Loop
Close #2
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: 2 lines of "VB" message to show
« Reply #2 on: June 17, 2019, 05:42:21 AM »
Thank you for a quick reply,  :)
We got it working, but it reads through the file and flickers everything on the screen until it gets to the last line. We'll see if we can get it to just display the last 2 lines.

We'll post back with results sometime next week.

Online TPS

*
  •  2,501 2,501
    • View Profile
Re: 2 lines of "VB" message to show
« Reply #3 on: June 17, 2019, 05:46:23 AM »
this should work without filckering

Code: [Select]
Open "C:\Mach3\Lasterrors.txt" For Input As #2 ' Open to read file.
Do While Not EOF(2)
Line Input #2, FileData ' Read a line of data.
LineN_1 = GetUserlabel(150)
LineN = FileData
Loop
Close #2
SetUserLabel(151,LineN_1)
SetUserLabel(150,LineN)   



anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: 2 lines of "VB" message to show
« Reply #4 on: June 18, 2019, 10:39:28 AM »
Thank you again for the reply TPS, the flickering is gone but both lines display the same line.

I've searched around for ways of counting the number of lines in a text file and need to experiment reading the last and second last lines into memory so it can be displayed.

Getting a bit late so will continue tomorrow.

Your solution looks less cumbersome, unfortunately my knowledge of VBA is very limited for me to change your script to it work.

Thank you again for your help.

Online TPS

*
  •  2,501 2,501
    • View Profile
Re: 2 lines of "VB" message to show
« Reply #5 on: June 18, 2019, 10:47:34 AM »
sorry my fault, not tested

Code: [Select]
Open "C:\Mach3\Lasterrors.txt" For Input As #2 ' Open to read file.
Do While Not EOF(2)
Line Input #2, FileData ' Read a line of data.
LineN_1 = LineN
LineN = FileData
Loop
Close #2
SetUserLabel(151,LineN_1)
SetUserLabel(150,LineN) 
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: 2 lines of "VB" message to show
« Reply #6 on: June 19, 2019, 03:25:30 AM »
Thank you so much  :). That worked like a charm. Besides the help it also teaches us a few tricks as well. :)