Any way I could have a script execute anytime the At filter changes?

Hook into Filter Change
BECOME PART OF THE COMMUNITY - Sign up here
-
-
So I think I answered my own question, here is where I arrived at the moment.
I noticed that the callback runs twice each filter change so added this runonce expression to get around that.
local my_handle = select(4,...);
local function main()
local runonce = y
local hookObject = CurrentEnvironment().AtFilter
local pluginHandle = my_handle:Parent();
local callbackFunction = function(obj)
if runonce == "y" then
FilterName = tostring(CurrentEnvironment().AtFilter.FilterRef.Name)
Printf(FilterName)
runonce = "n"
else
runonce = "y"
end
end
HookObjectChange(callbackFunction, hookObject, pluginHandle)
end
return main