Compare date string
Moderators: Dorian (MJT support), JRL
Compare date string
I want to compare the date of an update file on the server to todays date and then send an e-mail if the Date and my the update file do not match. I have tried the following but the test returns the second message box no matter what the date are.
FileDate>\\server\sys\Anti_Virus_Updates\Current\VSCANDAT1000\DAT\0000\update.ini,MyFileDate
Month>month
Day>day
Year>year
if %myfiledate%Mcafee update out
endif
if %myfiledate%=%year%%month%%day%
message> %year%%month%%day% %myfiledate%, Mcafee update Current
endif
FileDate>\\server\sys\Anti_Virus_Updates\Current\VSCANDAT1000\DAT\0000\update.ini,MyFileDate
Month>month
Day>day
Year>year
if %myfiledate%Mcafee update out
endif
if %myfiledate%=%year%%month%%day%
message> %year%%month%%day% %myfiledate%, Mcafee update Current
endif
JOE
Should be:
if>%myfiledate%Mcafee update out
endif
And:
if>%myfiledate%=%year%%month%%day%
message> %year%%month%%day% %myfiledate%, Mcafee update Current
endif
if>%myfiledate%Mcafee update out
endif
And:
if>%myfiledate%=%year%%month%%day%
message> %year%%month%%day% %myfiledate%, Mcafee update Current
endif
MJT Net Support
[email protected]
[email protected]
I think I have jumped the gun, The script still returns the first message no matter what the two dates.
FileDate>\\server\sys\WINDATA\Anti_Virus_Updates\Current\VSCANDAT1000\DAT\0000\update.ini,MyFileDate
Month>month
Day>day
Year>year
if>%myfiledate%%year%%month%%day% %myfiledate%,
endif
And:
if>%myfiledate%=%year%%month%%day%
message> %year%%month%%day% %myfiledate%, Mcafee update Current
endif
FileDate>\\server\sys\WINDATA\Anti_Virus_Updates\Current\VSCANDAT1000\DAT\0000\update.ini,MyFileDate
Month>month
Day>day
Year>year
if>%myfiledate%%year%%month%%day% %myfiledate%,
endif
And:
if>%myfiledate%=%year%%month%%day%
message> %year%%month%%day% %myfiledate%, Mcafee update Current
endif
JOE
Try this code:
FileDate>\\server\sys\WINDATA\Anti_Virus_Updates\Current\VSCANDAT1000\DAT\0000\update.ini,MyFileDate
Month>month
Day>day
Length>day,ld
If>ldday=0%day%
Endif
Year>year
Let>today=%year%%month%%day%
MessageModal>%MyFileDate% MyFileDateYes
Else
MessageModal>No
Endif
Let me know what appears in the first message box. Does it look right? If MyFileDate is less that today Yes will appear in the next message box, otherwise it will display No.
Your script was using non modal message boxes so it was probably just running right through and the second message was obliterating the first. Message (without the Modal) doesn't wait for you to press OK and the script carries on. MessageModal is what you want for debugging and showing the outcome of logical steps as you have time to read it and only when you hit OK will the script continue.
FileDate>\\server\sys\WINDATA\Anti_Virus_Updates\Current\VSCANDAT1000\DAT\0000\update.ini,MyFileDate
Month>month
Day>day
Length>day,ld
If>ldday=0%day%
Endif
Year>year
Let>today=%year%%month%%day%
MessageModal>%MyFileDate% MyFileDateYes
Else
MessageModal>No
Endif
Let me know what appears in the first message box. Does it look right? If MyFileDate is less that today Yes will appear in the next message box, otherwise it will display No.
Your script was using non modal message boxes so it was probably just running right through and the second message was obliterating the first. Message (without the Modal) doesn't wait for you to press OK and the script carries on. MessageModal is what you want for debugging and showing the outcome of logical steps as you have time to read it and only when you hit OK will the script continue.
MJT Net Support
[email protected]
[email protected]
Well maybe the date of your file only matches one of the conditions.
MJT Net Support
[email protected]
[email protected]
Well it's working correctly for you. JoeBo's problem must have been something else then. Was just covering all bases and simply pointing out that message (rather than MessageModal) does not wait and therefore using more than one message for debugging can be unhelpful as subsequent messages obliterate the first.
MJT Net Support
[email protected]
[email protected]