Help file:
$highlight(N/text)
Returns the Nth line in the highlight listbox, or if text is specified, returns the properties for the highlight line that matches text.This means that if you use $highlight($1-) in your on TEXT event, it would return the
item in the Highlight List that actually caused the highlighting, if it did. If not, it would return $null. For example, $highlight(Hello qwerty! How are you?) would return "$me" (if, of course, I had added "$me" in the Highlight List). This feature practically provides a perfect substitute for an on HIGHLIGHT event. If you combine it with signals, you can even script such an event:
on *:text:*:#: if $highlight($1-) != $null { .signal -n highlight $ifmatch }
on *:signal:HIGHLIGHT:{
echo -s Highlight triggered: $1-
}