Sign in to follow this  
Followers 0
nikolajp

HELP! Setting font selected string in a Rich Text Box?

3 posts in this topic

I have made a log viewer to output textfiles in a Rich Text Box control.

I know how to change the fonttype for the entire box by using this:

With $oRP

.Font = 'Arial'

EndWith

I need to higlight certain text (string match) in the textbox (like some errors etc.)

In the Rich Text box helpcode provided with Auto-ITyou can manually select the text and choose font by clicking a button. The code used from the example to change font:

$oRP.SelFontSize = 8

I need the script to automatically match certain strings and highlight this (or the line) with a different font/colour.

I just don't know how to search this Rich Text Box, get the coordinates and tell it to change like using $oRP.SelFontSize.

I have searched the site, but cannot seem to find anything like it with a Rich Text box.

I would be extremely glad for some assistance, as this is the final hurdle.

Share this post


Link to post
Share on other sites



I have made a log viewer to output textfiles in a Rich Text Box control.

I know how to change the fonttype for the entire box by using this:

With $oRP

.Font = 'Arial'

EndWith

I need to higlight certain text (string match) in the textbox (like some errors etc.)

In the Rich Text box helpcode provided with Auto-ITyou can manually select the text and choose font by clicking a button. The code used from the example to change font:

$oRP.SelFontSize = 8

I need the script to automatically match certain strings and highlight this (or the line) with a different font/colour.

I just don't know how to search this Rich Text Box, get the coordinates and tell it to change like using $oRP.SelFontSize.

I have searched the site, but cannot seem to find anything like it with a Rich Text box.

I would be extremely glad for some assistance, as this is the final hurdle.

I can only give you clues because I haven't used richedits in Autoit.

But there should be a function $oRP.FindText, and to set the font colour etc you will need to use $oRP.SelAttributes after you have set Selstart to the start of the text to highlight, and Sellength to the length of the text you want to select.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I can only give you clues because I haven't used richedits in Autoit.

But there should be a function $oRP.FindText, and to set the font colour etc you will need to use $oRP.SelAttributes after you have set Selstart to the start of the text to highlight, and Sellength to the length of the text you want to select.

Thanks for the reply.

But I can't seem to get the $orp.FindText to work.

I tried $orp.FindText("test") or $orp.FindText = "test", but it results in a crash when running the program.

I figured out how to set the font like you said. With this code.

With $oRP

.SelStart = 2

.SelLength = 4

.SelFontSize = 20

EndWith

But I cannot figure out how to search the contents of the RTF box for a string and get the SelStart for the match.

Anyone have any ideas?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0