 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Stefan16 Guest
|
Posted: Tue Mar 07, 2006 12:25 am Post subject: time limit like a trial software for script, how to do it? |
|
|
Hello. I would like to make at school a few small scripts that will have a time limit like a trial software. Do anyone know a script to do it?
regards,
stefan |
|
| Back to top |
|
 |
Gohslty...
Joined: 30 Jan 2006 Posts: 8
|
Posted: Tue Mar 07, 2006 1:52 am Post subject: |
|
|
if youre looking for something that cannot be bypassed, i dont know...but you could do a simple read and write to a ini file placed somewhere. You could write each time the script is opened or take the amount of days (time) and go from there.
someone may have a better idea. |
|
| Back to top |
|
 |
Lemming
Joined: 20 Dec 2005 Posts: 150 Location: Malaysia
|
Posted: Tue Mar 07, 2006 4:55 am Post subject: Expiry date |
|
|
What a coincidence. I just wrote something for this:
| Code: | ; ------------------
; Check For Expiry routine
; ------------------
CheckExpiry:
FormatTime, CurrentYear , YYYY, yyyy
FormatTime, CurrentMonth , MM, M
If (CurrentYear > 2006 Or CurrentMonth > 8) ; valid till Sept 1.
{
MsgBox,, Beta version expired, `n Pls contact Lemming for new version. `n`n
ExitApp
}
Return |
This just checks the current system date, and will Exit after Sept 1. You can call it with
Gosub, CheckExpiry
Note that users can just change the PC's date though. |
|
| Back to top |
|
 |
TDMedia
Joined: 26 Nov 2005 Posts: 196
|
Posted: Tue Mar 07, 2006 4:59 am Post subject: |
|
|
Yeah, there's not much that you can do that's completely unbeatable. The closest to that is a "hidden" registry entry. You'd be surprised at how many users don't know about that method (or the registry at all, for that matter.) So, on first run, have the script add a registry entry to an inconspicuous registry location that tells what time it is, then on every other boot, have it read that entry and if a certain amount of time - days, months, whatever - has passed, have it give a MsgBox that it's expired and close.
What I find will enhance the security of this is making the script compare the dates between loads. If the date or time ever decreases (except for DST) then the script will invalidate itself early because accurate time tracking is impossible. Not foolproof, but better than nothing. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 07, 2006 5:29 am Post subject: |
|
|
great idea but i get ERROR: TARGET LABEL DOES NOT EXIST.
i have use it on my scripts like that
CheckExpiry:
FormatTime, CurrentYear , YYYY, yyyy
FormatTime, CurrentMonth , MM, M
If (CurrentYear > 2006 Or CurrentMonth > ; valid till Sept 1.
{
MsgBox,, Beta version expired, `n Pls contact Lemming for new version. `n`n
ExitApp
}
Return
and
Gosub, CheckExpiry:
FormatTime, CurrentYear , YYYY, yyyy
FormatTime, CurrentMonth , MM, M
If (CurrentYear > 2006 Or CurrentMonth > ; valid till Sept 1.
{
MsgBox,, Beta version expired, `n Pls contact Lemming for new version. `n`n
ExitApp
}
Return
get all time same ERROR. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 07, 2006 5:41 am Post subject: |
|
|
this script work as its own, but if I put it in the beginning of my scripts, they don't work
; ------------------
; Check For Expiry routine
; ------------------
CheckExpiry:
FormatTime, CurrentYear , YYYY, yyyy
FormatTime, CurrentMonth , MM, M
If (CurrentYear > 2006 Or CurrentMonth > ; valid till Sept 1.
{
MsgBox,, Beta version expired, `n Pls contact Lemming for new version. `n`n
ExitApp
}
Return |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Mar 07, 2006 11:24 am Post subject: |
|
|
Remove the Return so AHK will continue to the next lines of code...
And in the Gosub command, you must not put the colon, only after the label definition.
Note this is a problem many shareware authors are trying to solve, without perfect solution.
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. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1238
|
Posted: Tue Mar 07, 2006 11:45 am Post subject: |
|
|
| Maybe there is a file which always gets modified when the computer boots up (hence its date changes) - you could read its date to check that the date of that file wasn't AFTER the system date (i.e. someone tried changing the date manually before running your script to a time when the script hadn't "expired"). |
|
| Back to top |
|
 |
Lemming
Joined: 20 Dec 2005 Posts: 150 Location: Malaysia
|
Posted: Tue Mar 07, 2006 11:46 am Post subject: maybe check index.dat |
|
|
I thought of checking the file date from index.dat instead of the system date which can be faked.
index.dat is apparently used and updated by IE, and is present on any Windows PC. The file's access date and modification date are usually current, so that could be used to find out the "real" system date.
For Win2K and WinXP, it is usually in:
\Documents and Settings\<Username>\Cookies\index.dat
Not many users know it even exists.
More details from:
http://www.acesoft.net/delete_index.dat_files.htm
Interestingly, there seems to be a whole bunch of utilities and discussions dedicated to removing this particular file! |
|
| Back to top |
|
 |
TotalUninstall ! Guest
|
Posted: Tue Mar 07, 2006 11:51 am Post subject: |
|
|
| TotalUninstall ! |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Tue Mar 07, 2006 12:01 pm Post subject: |
|
|
The script is working nice solutions, but a solution with a hidden registry key seems to be better and more secure. Has somebody a similar easy solution? |
|
| Back to top |
|
 |
kapege.de
Joined: 07 Feb 2005 Posts: 186 Location: Munich, Germany
|
Posted: Tue Mar 07, 2006 1:40 pm Post subject: Re: Expiry date |
|
|
| 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*
 _________________ Peter
Wisenheiming for beginners: KaPeGe (German only, sorry) |
|
| Back to top |
|
 |
Stefan16 Guest
|
Posted: Tue Mar 07, 2006 2:04 pm Post subject: |
|
|
| can you explain it what do you mean with "AND" "Or" with an example please? |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Mar 07, 2006 2:14 pm Post subject: |
|
|
Truth, the proggy stop to work on the 1 january 2007 herewith:
If (CurrentYear > 2006 Or CurrentMonth > 8 )
But if I'm using the AND command and not Or it does not work also
And I was sooo happy. |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Tue Mar 07, 2006 2:32 pm Post subject: |
|
|
The call to FormatTime given by Lemming is a bit strange, or out of context.
| Code: | CheckExpiry:
FormatTime currentYear, , yyyy
FormatTime currentMonth, , M
;~ MsgBox Y: %currentYear%`nM: %currentMonth%
If ((currentYear = 2006 and currentMonth > 8) or currentYear > 2006) ; valid till Sept 1st, 2006
{
MsgBox Beta version expired`nContact author for new version.
ExitApp
}
Return
|
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Last edited by PhiLho on Tue Mar 07, 2006 2:40 pm; edited 1 time in total |
|
| 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
|