Date functionality with VB scripting

I have an issue. My boss wants me to automate monitoring of NT Backup and Acronis Backup log files.  The problem is that not every customer backs up every night.  I need to be able to determine if a log file has been created in the last 16 hours (or day if need be), however every time I try to work with file/system date information, I can't seem to convert it to a workable format.

I've tried converting the info to a date format and stuffing it into a variable, but no matter what I do, the variables keep getting converted back to dynamic/string format.  This makes it impossible for me to do any comparison of the dates without some serious parsing, which is complicated further by the vb scripting engine declaring that the mid() function isn't a real function. (WTH?)

Any assistance would be appreciated.

Cheers!

Hi Keith,

Please find the attached project which will demonstrates using dates to filter the listing of files.

Regards,
Paul.

DateExample.zip (2.266 KB)

Thank you for your reply.

The problem is that this script will be run on a daily basis. I don’t want to have to go in and re-create the script every day before it runs. The script needs to be able to take the current date from the system time and compare that to the date on the file.

I wound up writing a VB6 application that pretty much did all the tests (including scanning the contents of the files). Now all Saaz has to do is locate the files and send e-mails if my exe finds an error.

Still, I should be able to use standard VB Scripting to declare date type items and do true compares, but something about the scripting engine keeps converting them back to variants.

Cheers!

Hi Keith

Which operation system/sp are you working on? I just tested here and if I assign a vbscript date to an automise variable, then it stays as a date unless it is manipulated using the set variable action. I also tested the Mid function and it works as expected. I suspect you may have an old version of active scripting on your machine.

Also, I see you mentioned Saaz, and from that I would guess that you are using the Zenith OEM edition of automise? If that is the case then I have to ask that you contact them for support, as that was part of the deal that we agreed with them.

Ok. I’ll take it up with the provider. I was just hoping someone here might be able to help as well.

Never can have too many resources for this kind of stuff.

Cheers!