It is easiest in Lua because that gives a trigger the style runs for the triggered line. I will show you the idea in Lua, you can adapt that to Jscript if you want.
The trigger (currently matches everything):
<triggers>
<trigger
enabled="y"
match="*"
script="my_trigger"
sequence="100"
>
</trigger>
</triggers>
And in my script file I had this code:
function my_trigger (name, line, wildcards, styles)
for k, v in ipairs (styles) do
print ("Style ", k,
" contents = ", v.text,
" colour = ", RGBColourToName (v.textcolour))
end -- for loop
end -- my_trigger
Running this on my prompt line gives me this:
Style 1 contents = < colour = silver
Style 2 contents = 100/100hp colour = yellow
Style 3 contents = 143/143m colour = cyan
Style 4 contents = 210/210mv colour = lime
Style 5 contents = 0/343xp colour = magenta
Style 6 contents = > colour = silver
You can see from this that the contents (the text of the style) is shown individually for each one, followed by its colour.