Thanks a lot guys for your help, but this is my problem more specifically so I’ll appreciate if you can provide me with a more specific advice since I just begin with Tcl some months ago.
This is the procedure that I’m using currently but it only works with fixed text not with variable text mixed in it.
proc Ifreceived {expectString} {
global textView beginIndex
#get the last index
set lastIndex [$textView index end]
if {[$textView search $expectString $beginIndex $lastIndex] != ""} {
set returnCondition 0
} else {
set returnCondition 1
}
return $returnCondition
}
This procedures tells me if the string that I looking for is present in the current text then what I need to know is how to skip the time and date string (that is variable) and continue searching the substring at the end of my expected string.
Some examples of the expected string are :
"comdac-1-2,EQPT:,CPINIT,SC,03-10,08-28-15,,,\"pack initialization in progress\""
"comdac-1-1,EQPT:,CPINIT,SC,03-10,08-29-37,,,\"pack initialization in progress\""
"comdac-1-2:CPINIT,CL,03-10,08-32-56:\"pack initialization finished""
"comdac-1-1:CPINIT,CL,03-10,08-33-25:\"pack initialization finished""
"comdac-1-1

BMEMTR,SC,03-10,08-31-45:\"data memory update in progress\""
"comdac-1-1

BMEMTR,CL,03-10,08-32-53:\"data memory update completed\""
A lot of different strings like this are arriving at my text widget constantly, but I need to know if just some string has arrived. So what I need to know is somehow modify my current procedure to ignore the date and time substrings and just looking for the substrings at the begining and the end of the complete string.
Basically I need to know when comdac-1-2 has finished with initialization but if I’m expecting the string "pack initialization finished" comdac-1-1 is also sending the same string when it finished then I need to look at the beginig of the string to see if the one that has finished is comdac-1-1 or comdac-1-2.
I guess that regexp colud be the best way to implement this but unfortunately I’ve not experience enough.
Again, thanks for your help.