fiodal Posted June 18, 2006 Share Posted June 18, 2006 I need my script to look at todays date. If it is equal or passes my expiry date and it should exit my script Can anyone tell me how to make my script stop working after a critain date. So far I have this, but it doesn't seem to work. I'm not sure if I'm even writing the code properly. Your assistance would be greatly appricitated. #Include <date.au3> $ExpireDate = "012/31/2006" If $ExpireDate = _NowDate() Then ;Message the script has expired Quit Else ;Message: The script has not past the expiry date. Do these steps EndIf Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 That's because you have the date as a string, and 012/31/2006 will never exist... #include <date.au3> $ExpirationDate = '6/18/2006' If _NowDate() = $ExpirationDate Then MsgBox(64, 'Info:', "I'm sorry but your license has ended") Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 18, 2006 Developers Share Posted June 18, 2006 That's because you have the date as a string, and 012/31/2006 will never exist... #include <date.au3> $ExpirationDate = '6/18/2006' If _NowDate() = $ExpirationDate Then MsgBox(64, 'Info:', "I'm sorry but your license has ended")This will only show the message today... what about tomorrow ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 (edited) This will only show the message today... what about tomorrow ? I was only going off his code without thinking of > ... if that's the case then seperating it into @Mon - @MDay - @Year seems a lot more feasible to me then _NowDate() and parsing that.Edit:The more I think about this, I would just put the current date of installation somewhere, and then use a variable with the amount of days I'm going to give, and _DateAdd() to todays date, and compare it that way. Edited June 18, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 18, 2006 Developers Share Posted June 18, 2006 I would use something like: $ExpirationDate = 20060618 If $ExpirationDate <= Number(@YEAR & @MON & @MDAY) Then MsgBox(64, 'Info:', "I'm sorry but your license has ended") Exit EndIf SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 18, 2006 Moderators Share Posted June 18, 2006 I would use something like: $ExpirationDate = 20060618 If $ExpirationDate <= Number(@YEAR & @MON & @MDAY) Then MsgBox(64, 'Info:', "I'm sorry but your license has ended") Exit EndIfWhat happens when the expiration date is up, they get to use it just kidding your using <= rather than > Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted June 18, 2006 Developers Share Posted June 18, 2006 What happens when the expiration date is up, they get to use it just kidding your using <= rather than >yea you are rigth.. it should be >= SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
fiodal Posted June 19, 2006 Author Share Posted June 19, 2006 Ok,, Here is the thing... the 012/31/2006 was a type o.. I meant 12/31/2006.. But I really appriciate all your responses and the options you have given me, and I will try them ASAP. Oh,, by the way,, yes,, it should be >= Again.. Thank you all.. Link to comment Share on other sites More sharing options...
fiodal Posted June 19, 2006 Author Share Posted June 19, 2006 Nope.. it's <=.. I tried >= and it doesn't work.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 19, 2006 Moderators Share Posted June 19, 2006 Nope.. it's <=..I tried >= and it doesn't work..Maybe for how you have your script set up, but if you look at the example that was given, it's >= that would make the statement true. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now