It's because it's a .wsf file. That spyware detector will detect it if any script file is being run. This includes files like:
.wsf
.vbs
.js
.bat
etc.
The snippet needs to be a .vbs/.js/.wsf as the code depends on those script interpreters.
There is a way to have a sleep command without needing a file. Fortunately it relies on using a hack on a command line utility that should be in any Windows version that came with TCP/IP, more specifically pathping.exe. Hopefully it works the same way it does as in Windows XP, or I can't guarantee it would still work. It's particularly funny that I use pathping.exe for a /pause command, but it was simply the only dos utility that comes with Windows that I could find, that let's me specify an interval in milliseconds. A version that I was making prior to this one was using ping.exe, but that only lets you specify seconds for intervals.
/*
Usage: /pause <milliseconds>
Examples:
//var %ticks = $ticks | pause 1500 | echo -a Paused for: $calc($ticks - %ticks)
//pause 3000 | echo -a Hi there
Note it is not to be used with values under 100. You can, but it will pause 100 ticks too long, and isn't very accurate. So /pause 30 will pause for 125-130 milliseconds instead, nothing I can do about that.
Note that with higher intervals, there will sometimes be a small deviation from the value you specified, fex in the example where you pause for 1500 milliseconds, it sometimes pauses for 1515 milliseconds, so 15 milliseconds too much, although often it is right on the spot.
If you want for something beneath 100 milliseconds to pause you should just do:
//var %a = $ticks + 100 | while ($ticks < %ticks) ! | ...
Although I mention these deviations, note that with the original alias with the .wsf file that you are using, the deviation is much greater, so this alias scores better in terms of accuracy, whilst not needing to do any file access, or triggering Spyware detectors.
*/
alias pause {
if ($1 !isnum 1-) return
var %wsh = wsh $+ $ticks
.comopen %wsh wscript.shell
.comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c pathping -n -w 1 -q 1 -h 1 -p $iif($1 > 100,$calc($1 - 100),$1) localhost >nul,uint,0,bool,true)
}