oh yeah i finnaly understand ^^
but, how can search in the text my keyword ?
for exemple def:
code:
function OnWndScriptEnvEvent_EditTextChanged( pPlusWnd, sControlId ) {
if ( sControlId === 'txtMessage' ) {
sMessage = EnvWindow.GetControlText("txtMessage")
var hObjWnd = pPlusWnd.GetControlHandle (sControlId);
for (i = 0; i < sMessage.length+1; i++){
if(sMessage.charAt
=="d"){
for (j = i+1; j < sMessage.length+1; j++){
if(sMessage.charAt(j)=="e"){
for (h = j+1; h < sMessage.length+1;h++){
if(sMessage.charAt
=="f"){
Interop.Call('user32', 'SendMessageW', hObjWnd, EM_SETSEL, i, h);
MyWindow.RichEdit_SetCharFormat("txtMessage",true,-1,-1,-1,-1,-1,0x00ff0000,"");
}
}
}
}
}
}
}
}
Have I to do that for every keyword

???
EDIT: How to Unselect my text after it has been replaced ?
EDIT: I found that and it work pretty good, but i still ask how can i unselect the texte after it has been colored ^^
code:
function OnWndScriptEnvEvent_EditTextChanged( pPlusWnd, sControlId ) {
if ( sControlId === 'txtMessage' ) {
sMessage = EnvWindow.GetControlText("txtMessage")
var hObjWnd = pPlusWnd.GetControlHandle (sControlId);
i = sMessage.indexOf("def",0)
if(sMessage.charAt(i+1)=="e" && sMessage.charAt(i+2)=="f"){
Interop.Call('user32', 'SendMessageW', hObjWnd, EM_SETSEL, i,i+3);
EnvWindow.RichEdit_SetCharFormat("txtMessage",true,-1,-1,-1,-1,-1,0x00ff0000,"");
}
}
}
EDIT: i've found it tu unselect:
code:
Interop.Call('user32', 'SendMessageW', hObjWnd, EM_SETSEL, -1,-1);
but i'm scared of how mani "loop for" i will use to do a global... 'cause this method juste replace the first "def" entry.