Preventing Flickering Text on GuiCtrlLabel when Reading from File

Recommended Posts

TheCrimsonCrusader 0

TheCrimsonCrusader 0

The short story of this script is I have a loop that is reading a text file (x:\result.txt). Line #5 in this text file constantly gets updated from the output results of the "pgp.bat and the pgp1.bat" files, so I have the loop reading the file constantly and updating the label with what is read. The change of what is read is constant, but I am trying to eliminate the expected "flickering" problem with the label that gets updated.

I've dabbled with the ControlSetText and GUICtrlSetData commands from prior examples, but I haven't been having any luck in having it work in this sample code. Yes, calling the batch files is cheesy, but I am only doing that temporary as I will have to convert some characters over to the ASCII codes before moving them into AutoIt. The $totalblocks label only gets ran one time, since that is static label, but the $blocksremaining label in the loop is the label that would be constantly updated.

Share this post

Link to post

Share on other sites

TheCrimsonCrusader 0

TheCrimsonCrusader 0

Sorry, I guess I should have mentioned that. I've tried various sleep intervals and while it does help some, it doesn't eliminate the problem of flickering entirely, it just spaces them out more in terms of their frequency and I would like for the "blocks remaining" count to be updated somewhat frequently.

Share this post

Link to post

Share on other sites

martin 66

martin 66

Sorry, I guess I should have mentioned that. I've tried various sleep intervals and while it does help some, it doesn't eliminate the problem of flickering entirely, it just spaces them out more in terms of their frequency and I would like for the "blocks remaining" count to be updated somewhat frequently.

DOn't create thousands of labels!

Create a label once at a150, 120 and give it the required font. Don't do that in your while loop.

In your while loop just change the text in the label with GuiCtrlSetData.