your asking a script specific question.
did you write the script?
if no, then i sugest u contact the person who did, or simply find anouther script that does what u want that does work. Its not a good idea to atempt to edit other ppl's scripts as a newbie, because more goes on in the code then u realize, and even if u manage to fix the first problem, u could have likely created anouther.
if yes, then paste the startup alias to the script so we can see it, and explain in more detail what a 'host scanner' is.
to me a host scaner is where i can scan a channel for all users matching a wildcard string host and show results, in which case .. u normaly wouldnt execute from the status window, because there are no users there to check?
if your script depends on $chan to work, $chan is null unless the script is trigered by a manualy typed alias in a channel editbox, or by a channel related event, such as join, part, etc etc.