Hi Matt,
WScript.Quit(errorlevel) is the correct command
within your script. The problem is that you probably need to explicitly
call cscript and pass it the vbs script name as mentioned before. Cscript
is always used to process WScript or VBScript, but depending on your
environment, you may need to explicitly call it instead of just calling the vbs
script directly. Try it, you'll like it...<grin>.
Yes, this will be fine for testing, but once you
try to move this to a production environment, you'll most likely find that the
load and parse time for the script multiplies the run time by a factor of 10,
probably running it into the 1000 millisecond range to process.
Compiling the code would definitely be the way to go, dropping the processing
time to on the order of 100 milliseconds without any other
optimization.
For those that run .NET environments, I don't mind
compiling it into a console app...requires a few changes due to the differing
object structure, but it wouldn't take that long.
Darin. ----- Original Message -----
From: Matt
Sent: Tuesday, April 06, 2004 5:28 PM
Subject: Re: [Declude.JunkMail] Test for message size and return
codes This is something that would be configured as an external test in Declude, and it's not calling any other programs so I'm not sure that cscript is useful here. If I was calling something like Sniffer, I do understand that the call should be made with cscript though. I also understand the limitations of scripted code vs compiled code, but I can do some basic scripting (most of my experience is in simple database ASP stuff) and test some ideas before finding someone to code it up as something that can be compiled. For something as basic as checking just the file size, this should work plenty fast though, it doesn't even need to open the file. The real issue that I have though is pumping out a result code from vbscript to Declude. From my reading of things, the WScript.Quit method should do this, but it's not working. BTW, there is no CScript.Quit method. Here's the page on MSDN for WScript.Quit: http://msdn.microsoft.com/library/default.asp?url=""> I can't find anything else in vbscript that is supposed to be used for returning a result code except for an old method for ExitProcess that existed before WScript.Quit came around. Here's an example of that, but I'm not sure how to use it exactly, or even if that would work. http://www.mentalis.org/apilist/ExitProcess.shtml I'm more concerned that WScript.Quit is sending the exit code back to Declude in the wrong format, or possibly that you just can't use vbscript, or at least WScript to return a result code. This one little script is only one of many little but useful things that could be done if I can get my hands around this. I came across similar problems when I was trying to create a handler for Sniffer that would skip calling Sniffer if the weight was already high enough for my Drop setting. I thought the problem was related to retrieving the result code from Sniffer, but it will echo it in testing, however I can't get it to Declude in proper result code format. Matt Darin Cox wrote:
-- ===================================================== MailPure custom filters for Declude JunkMail Pro. http://www.mailpure.com/software/ ===================================================== |
- [Declude.JunkMail] Test for message size and return codes Matt
- RE: [Declude.JunkMail] Test for message size and retu... Kevin Bilbee
- Re: [Declude.JunkMail] Test for message size and retu... Darin Cox
- RE: [Declude.JunkMail] Test for message size and retu... Colbeck, Andrew
- Re: [Declude.JunkMail] Test for message size and ... Matt
- Re: [Declude.JunkMail] Test for message size ... R. Scott Perry
- RE: [Declude.JunkMail] Test for message s... Kevin Bilbee
- [Declude.JunkMail] Tell junkmail not... Peter Lowish
- Re: [Declude.JunkMail] Tell junk... R. Scott Perry
- RE: [Declude.JunkMail] Tell ... Peter Lowish
- Re: [Declude.JunkMail] Test for message size ... Darin Cox