This has been done before, I modified it to use the output window - it seems to work with unsaved files :
function mark_all() -- Mark and list occurrences
-- Modified from
http://lua-users.org/wiki/SciteMarkWord -- Fail if no selected text
if editor.SelectionStart == editor.SelectionEnd then
return
end
-- Use the current selection
local txt = editor:GetSelText()
-- Select the indicator properties
local indic = scite.SetIndicator("word")
-- Clear previous marks of this type - disable if you want to add marks together
scite.SendEditor(SCI_INDICATORCLEARRANGE, 0, editor.Length)
-- Setup the search parameters
local flags = 0 --SCFIND_WHOLEWORD
-- Perform an initial search
local s,e = editor:findtext(txt,flags,0)
-- Loop through the file
while s do
scite.SendEditor(SCI_INDICATORFILLRANGE, s, e - s)
trace(props.FileNameExt .. ":" .. (editor:LineFromPosition(s)+1) .. ":" .. editor:GetLine(editor:LineFromPosition(s)))
s,e = editor:findtext(txt,flags,e+1)
end
end