--[[
    This is an example script for the lua engine in TailExpert
    
    Purpose:
    This script will add a filter to an already opened tab and activate it 
]]--
require("Config")

-- Import WIndows Assemblies
import("System")
import("System.Windows.Forms")
import("System.Drawing")
import("System.Drawing.Drawing2D")

function click()
end

--[[
Required predefined functions: Are called from TailExpert, adapt to your needs
]]--

function OnEvaluate(LinesIn)
	PutLogLine('test')
    -- Do not put LogMessage() here this will overflow your logs as
    -- Evaluate is called every tail cycle
    -- If you need log make sure it's not output every cycle
	-- if ScriptInitialized == true then
	-- end
end

function OnEnter()
	ScriptInitialized = true
	KeepLuaWindow = false
	LogMessage(INFO, "InstallFilter.lua script OnEnter()")
    OpenFileTab("c:\\temp\\tailexpert.log", false, false, "tailexpert", false, MAXLOGLEVEL)
    local filter = AddFilter("c:\\temp\\tailexpert.log", "Add Filter", ALLCOLUMNS, CONTAINS, false, false, false)
    ActivateFilter("c:\\temp\\tailexpert.log", filter, true)
    -- tests the functions above
 	ScriptInitialized = true
end

function OnExit()
	LogMessage(INFO, "InstallFilter.lua script OnExit()")
 	ScriptInitialized = false  -- prevent Evaluate to be called
	
    if (dropDownItem ~= nill) then
       RemovePluginMenuEntry(dropDownItem)
    end
end

