Script Colors in Text Editor
What is the simplest way to make a text editor "color" spefic words, AND, even if you load a file containing these words it should auto color them in the color wanted.
I've downloaded a script before and learned how to do it, but is there a simple way to understand how the procedure is written? And how to make it check up words when you load a file into the editor.
Re: Script Colors in Text Editor
Perhaps the easiest way would be to use a RichTextBox. If you use spaces as a delimiter, you can scan through the text in a loop and set the color as desired. That requies selecting the text with the SelStart and SelLength properties of the box, and setting the SelColor property.
Re: Script Colors in Text Editor
But I need it to change the color to let's say "Blue" when I write "Hello" and if I write "Hello there" only Hello should be colored in blue. Also if I have a text document that I open containing the sentence "Hello there" it should automaticly color the "Hello" word.
Re: Script Colors in Text Editor
What you can do is watch for when the user types a space, and that would indicate that the word preceeding the cursor should be checked for coloring. When opening a document you would have to loop through the text. Depending on the specifics, you may be tweeking the code for awhile to get it to work.
Re: Script Colors in Text Editor
How can I make it check the word that I just wrote? It has to be something like Text.SelLength - 5 (if the word is 5 letters) when you press Space. Or how do you make it look back on what you just wrote? And make a .txt file containing the word to colorize.
1 Attachment(s)
Re: Script Colors in Text Editor
I could not find the author or post of this code. I am pretty sure it came from here though.
Re: Script Colors in Text Editor
Quote:
Originally Posted by superuser
I could not find the author or post of this code. I am pretty sure it came from here though.
Just an FYI... incase you want to contact the author... it was me...