Sign in to follow this  
Followers 0
fiodal

Adding an expiration date to script

10 posts in this topic

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

Share this post


Link to post
Share on other sites



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")


[center]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.[/center]

Share this post


Link to post
Share on other sites

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 ?

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This will only show the message today... what about tomorrow ?

:D

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 by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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
What happens when the expiration date is up, they get to use it :D just kidding your using <= rather than >

[center]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.[/center]

Share this post


Link to post
Share on other sites

What happens when the expiration date is up, they get to use it :D just kidding your using <= rather than >

yea you are rigth.. it should be >=

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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..

Share this post


Link to post
Share on other sites

Nope.. it's <=..

I tried >= and it doesn't work..

Share this post


Link to post
Share on other sites

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.

[center]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.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0