text1.text gets data from another window every 500ms using a timerthe text from the other window is the same, but just like a chat, new lines are added to the bottom(I already have this)the timer needs to add all the lines that havnt been added already to a listbox.then for each new line in the list box, it will loop though them processing the text untill the end. the problem is that it needs to know not to add the same lines twice.
Answer1:bump
Answer2:A quick solution is, to create a Private level boolean value, that you can check in your code where you add the line to the TextBox.Private bDisableLineAdd as Boolean
...bDisableLineAdd = True: List1.Additem "blabla": bDisableLineAdd = False...
If Not bDisableLineAdd Then Text1.Text = Text1.Text & sNewTextEdit: But i'm not sure is this helps you. It may be better to see the codeflow, you may want to redesign it.
Answer3:Quote:
Answer4:1) For i = UBound(Chat) To LBound(Chat) Step -1 'because you are counting the elements reverse order, you have to set the step size negative.2) i see now. try thisCode:
Answer5:I dont know how people like you can do this!did you litually write that directly on this forum?it worked exactly how i needed it... and im speechless! i thought id be struggleing on this for days. i even was about to go back to my original method... which never worked properly..ill show you my appriciation in a few days time
Answer6:May be it's not feasible in the context of your program but, can't the GetText(chatHwnd) function clear the text in the other window. If the function performs a "clean up" then these issues disappear an you can just check for any text. Like this.Code:
Answer7:I'm glad it works, i couldn test it, just type here as well.If you find your problem is solved, just go up here, and select the menu "Mark thread resolved" in the menu "thread tools".
Answer8:Quote:
Answer9:I found a problem with this Jim. it works fine at first, i have it on 1000ms timer.it starts off fine, but the loop takes longer and longer as it goes on, eventually taking over 1 second to complete, and it then starts getting every other line, then less and lessany ideas?
Answer10:The problem is might because of the huge amount of content you have to display. Try to replace the Poker Textbox addition, to just display a single line, not add to the current content. Also remove the Listbox addition.The Split() should work fine, i dont see any other issues regarding this problem.Let me see how the performance drops.Code:
Answer11:It parses it faster (as it doesnt have to display it).but still when it builds up, it doesnt refresh very well. takes longer each time, untill it starts missing lines.
Answer12:Have you placed a DoEvents, somewhere in the processings? If so, just remove it.Also, the (, , vbTextCompare) in split not necessary at all, vbCrLf can be processed binary as well.
Answer13:I had the timer set to 200.. ive changed it to 1000, so i will see how it goes.The idea is that it will read whats happeneing on a poker table, and it needs to be able to read the table for a long time, not missing any data, and not reading anything twice. it works perfect for the first 10 or so hands.
Answer14:... i found a doevents... i dont know how it got there! honest!it was in the loop.
Answer15:Ok, by removing the doevents, the process will be even faster. It will also dont miss lines, because the timer will not hit as long as the process is not finishing. So it solve the missing line problems.The another issue is that it takes so long to process the data. Can you please show me how you did it?For example, you just have to process those lines that comes new from the target textbox. The others are already processed. So it is better to place the processing in the loop where you add the lines to the textbox and listbox.Edit:
Another possible issue come in mind. What if the target textbox will be trimmed after a number of line counts? For example, most of the logging textboxes are trimmed after reaching the linecount 100. The code will fail in this case, because the counter will not get raised ever again... To avoid this to happen, you have to synchronize your code to this trimmings.
Answer16:Hey, i just read your edit on the last post. As the problem seems to of come back again. but i have not got any DoEvents anywhere now. It will work upto about 400 lines? maybe less i dont know. but it slows to a halt. in the loop, it will call a function on a module, which goes though alot of checking on the line, like if it contains different words, then split it, add usernames to listboxes, call a DLL to do some heavy maths etc...i increased the timer from 200ms to 500ms, it helps slightly, but i cant increase it as it will need to be updated frequently.I have taken out the lines where it adds it to a text box and listbox, so it just calls a function instead now.any ideas?
Answer17:Well 400 lines doesnt seems to me an issue, but it all based on your 'coding style'. For example, split()'ting up more than 10,000 elements to an array is could be done less than 100 milliseconds, or less. So it wont be an issue.Let us see the whole processing, from where you get the textbox content from the game, to the line of end sub. There could be some ways to optimize the process to give a significant speed up.
Answer18:this is on a 500ms timer:Code:
Answer19:What i'm see here, is that you continously cross reference between form and module (Form1.xxxx), that is a bad idea. Instead of that it would be better, to place everything on the form, there it will be able to call the controls without referencing them.Second, you can use StdPicture to store images in, so you dont have to loadpicture() the images, but you can simply pass the stdp to the picture boxes. Somewhere, in your initializations (eg Form_Load) load the images once to StdPictures.Code:
Answer20:ill try the things you have said, ThanksThis loops though a list box to see if a player has already been added to the list.Checks first if the player being looked for is "you", ... so not to add yourself to the list.Code:
Answer21:It would be better, to store the names in a local array, because calling a control's property, even its as array, takes even more processing time than simply calling a string array. You can store the names in this array, in sync with the listbox.Code:
Answer22:Well to get the text from the window, i had to pay someone to work out a way to do that! as its not just as textbox, its an "Internet Explorer_Server" window, that i had no way of getting, here is the "GetText" function i have been using.Code:
Answer23:It is may be reversed.1) GetText = htmlDoc.documentElement.outerText 'read the content
2) htmlDoc.documentElement.outerText = "" 'clear the contentSo it will clear the text area after read it. Then, in your code, you dont have to count the lines anymore, but you can simply split() the array, and process all its elements, because the received text will only contain the few last lines that are came between two timer ticks.
Answer24:Merri has posted a fast version of split here, you may want to use it to improve the speed of splitting the text.And another idea you could use it to store in a variable the ubound of the last text and in succeeding splits you can just loop on that last ubound (+1) until the new ubound. Something likeCode:
Answer25:@dee-u your second suggestion is that the code exactly does, but the problem is appears at, when the code have to process 400+ lines. There i suggested some improvements and workarounds for this issue, but it might be even better to using the same way the code gets the content, it may allow to clear the remote textbox, so the content will be just a few lines, that is should be extremely fast.Unfortunately i got no any response that the workaround is works or not.
Answer26:Well i havnt done that yet! i decided to try alot of things at once. im going to test to see if i can remove old text now, and i will let you know how it goes.as somthing i have realised also, that the way i had this poker window open, was with the chat window on the side, its much bigger than having the chat window within the poker window. i think that within the window it automatically clears after 1000 lines... but im testing that now also.although it looks like now that they have done an update to the software, it no longer clears..
Answer27:wasnt able to change the text,"cannot set the outertext property.."
Answer28:Ok, just try one of the following.htmlDoc.documentElement.Value = ""
or
htmlDoc.documentElement.Text = ""
or
htmlDoc.documentElement.innerText = ""
Answer29:all 3 gave same errors.
Answer30:Hey, i just thought of somthing which technically should work, and we have been missing...instead of trying to clear the external chat, why not i get the text from the window into a textbox, then process it from there, that way it is simple for me to clear?
zip code finder currency converters