 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Lemming
Joined: 20 Dec 2005 Posts: 158 Location: Malaysia
|
Posted: Tue Mar 07, 2006 1:34 pm Post subject: Re: Expiry date |
|
|
Yea, I'm sure someone could do all this in a single line.
But I wanted something readable and easily changed.
I figured since my script deals with the current (presumed) correct date, and time- travel has not been invented yet, then I wouldn't have to be concerned about any date before 2006.
Anyway, if you stuck an AND there, the script would start working again on Jan 2007 (CurrentMonth would become 1).
| kapege.de wrote: | | Lemming wrote: | | If (CurrentYear > 2006 Or CurrentMonth > 8 ) |
Should be AND, not OR. With OR your proggy stops also at September, 1st 2005 or January, 1st 2006. (OR means one of both has to be valid.)
*tested*
 |
|
|
| Back to top |
|
 |
Lemming
Joined: 20 Dec 2005 Posts: 158 Location: Malaysia
|
Posted: Tue Mar 07, 2006 1:45 pm Post subject: |
|
|
*Shrug* seems to work on my PC, and three other PCs I tested on. Plus the script logic seems sound to me - barring time-travel, or someone changing the PC's date.
Anyway, I just cobbled it together from rooting about the helpfile. Is there a better method to extract current system date, then make a comparison?
Would like to know for future improvement.
Thanks,
Lemming
| PhiLho wrote: | The call to FormatTime given by Lemming is a bit strange, or out of context.
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 07, 2006 1:52 pm Post subject: |
|
|
This script is also not working. The proggy do not stop to work.
CheckExpiry:
FormatTime currentYear, , yyyy
FormatTime currentMonth, , M
;~ MsgBox Y: %currentYear%`nM: %currentMonth%
If ((currentYear = 2006 and currentMonth > or currentYear > 2006) ; valid till Sept 1st, 2006
{
MsgBox Beta version expired`nContact author for new version.
ExitApp
} |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Tue Mar 07, 2006 1:57 pm Post subject: |
|
|
Hurra- this script do it - thanks. Untill now I have found no bug on it
CheckExpiry:
FormatTime currentYear, , yyyy
FormatTime currentMonth, , M
;~ MsgBox Y: %currentYear%`nM: %currentMonth%
If ((currentYear = 2007 and currentMonth > 3) or currentYear > 2007) ; valid till Sept 1st, 2006
{
MsgBox Beta version expired`nContact author for new version.
ExitApp
} |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Mar 07, 2006 2:49 pm Post subject: |
|
|
| Anonymous wrote: | This script is also not working. The proggy do not stop to work.
If ((currentYear = 2006 and currentMonth > 8 ) or currentYear > 2006) ; valid till Sept 1st, 2006
| We are not in September, yet...
| Stefan16 wrote: | | If ((currentYear = 2007 and currentMonth > 3) or currentYear > 2007) ; valid till Sept 1st, 2006 |
You should update the comment... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Tue Mar 07, 2006 3:29 pm Post subject: |
|
|
so the last script you adviced is perfekt PhiLho. Thank you.
| Quote: | | If ((currentYear = 2007 and currentMonth > 3) or currentYear > 2007) ; valid till Sept 1st, 2006 |
why do I need to update | Quote: | | "valid till Sept 1st, 2006" | ?? is it not only a comment for the programmer??
The proggy is working untill 1 of April 2007 and than the messagebox appears  |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Mar 07, 2006 3:57 pm Post subject: |
|
|
| Stefan16 wrote: | why do I need to update | Quote: | | "valid till Sept 1st, 2006" | ?? is it not only a comment for the programmer??
The proggy is working untill 1 of April 2007 and than the messagebox appears  |
Because it is confusing for the programmer! He (she) see this code, and wonder if the comment is right and the code is wrong or the reverse...
Even if the programmer is only you, you may be confused months later... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
TDMedia
Joined: 26 Nov 2005 Posts: 196
|
Posted: Fri Mar 10, 2006 3:13 am Post subject: |
|
|
| PhiLho wrote: |
I hate the "hidden registry key" trick: you try a software, remove it, and you get garbage in your registry, cumulating with the trials.
And anyway, I would use Regmon to see what is going on in the registry... And Filemon in case it checks some file. |
Generally speaking, I do too. That's why I also like to use installers that remove all signs of themselves when the uninstall app is run. InnoSetup is one example. The registry is screwed up as it is, and by no means should garbage be left there. As for the programs to monitor registry changes - the point I was making is that most users don't know about such apps, therefore a hidden entry can work in most cases. If you wanted to be really nasty to everyone, you could add a line of code that checks to see if the entry exists, and if not, disable itself. Honestly, I don't think that it should be a problem at all; all software that I create is free and stays free forever. I can see how someone may want to make a profit on software.... but I don't personally do it. |
|
| Back to top |
|
 |
Lemming
Joined: 20 Dec 2005 Posts: 158 Location: Malaysia
|
Posted: Fri Mar 10, 2006 5:53 am Post subject: For beta control |
|
|
Well, it's not always about profits or payment. Right now I don't charge anyone for my software even though it is used in a production environment.
In my case, the expiry date is simply because I don't want any copies of a beta version floating around after a certain date. My software doesn't have copy-protection or user/pc restrictions.
| Anonymous wrote: |
...
If you wanted to be really nasty to everyone, you could add a line of code that checks to see if the entry exists, and if not, disable itself. Honestly, I don't think that it should be a problem at all; all software that I create is free and stays free forever. I can see how someone may want to make a profit on software.... but I don't personally do it. |
|
|
| Back to top |
|
 |
TDMedia
Joined: 26 Nov 2005 Posts: 196
|
Posted: Fri Mar 10, 2006 7:13 am Post subject: |
|
|
| Well, that's very different. Like mentioned earlier, the target expiration can just be coded right into it. |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Fri Mar 10, 2006 3:38 pm Post subject: |
|
|
| Quote: | | expiration can just be coded right into it. |
And how...? |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Fri Mar 10, 2006 4:11 pm Post subject: |
|
|
The way you did...
TPMedia means that the expiration data can be hardcoded in the script: that's not "use this software 30 days and pay or burst", but "this software is good until this date, after that, it will decay"... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Fri Mar 10, 2006 4:19 pm Post subject: |
|
|
| The last script is very good, problem only that if you turn the date back, the software is working again. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Fri Mar 10, 2006 4:34 pm Post subject: |
|
|
Yes, it is OK for Lemming as users will probably prefer to get the latest version (hoping that there is one ready ) rather than messing with the clock.
For more robust solutions, reread the topic... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Mar 10, 2006 5:04 pm Post subject: |
|
|
| Sure PhiLho, this is a nice solution, but for me it is like a "half" solution because I don't want that anyone at school will use some of my applications that are not ready and just for testing for ever. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|