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

Kevin and Darin,

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:
Probably need to use cscript to call the vbs file like "cscript filesize.vbs d00000....smd"
 
Also, it would probably be much better to compile this into a C++ or C#/VB.net console app.  Interpreted code like this runs a lot slower than compiled.  Haven't done tests for this in the past couple of years, but it used to be an order of magnitude faster for compiled over interpreted.

Darin.
 
 
----- Original Message -----
From: Matt
Sent: Tuesday, April 06, 2004 3:53 PM
Subject: [Declude.JunkMail] Test for message size and return codes

Scott,

I have tried scripting several different things with vbscript for use as external tests in Declude to no avail.  Here for example is a simple piece of code that can detect if a message is above or below a certain size:

Dim Args, oFSO, oFile

Set Args = WScript.Arguments
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.GetFile(Args(0))

If oFile.size > 102400 Then
    'Return a code of 1
Else
    'Return a code of 0
End If

Set Args = nothing
Set oFile = nothing
Set oFSO = nothing

I have comments in there for the result codes because I tried the WScript.Quit(1) method and Declude doesn't pick that up.  From everything that I have read, it appears that this is the preferred method with vbscript (note that I'm not an expert in this area by any means), and the ExitProcess method indicated in your manual is an old work around that was appropriate (the only method) for old VB.

I've searched the Internet several times for a good example of returning a result code to Declude and I'm a bit stumped.  I was hoping that you or someone else has some vbscript examples that will work with Declude.  A lot could be done to add little functions like a test for size, which in my case, could be used to defeat certain filters that are targeted at zombie spam which are heavy on the BODY searches, such as GIBBERISH, !YDIRECTED, IPLINKED, and @LINKED (and I'm sure several more at least).

Thanks,

Matt
-- 
=====================================================
MailPure custom filters for Declude JunkMail Pro.
http://www.mailpure.com/software/
=====================================================

-- 
=====================================================
MailPure custom filters for Declude JunkMail Pro.
http://www.mailpure.com/software/
=====================================================

Reply via email to