Updated script.
Needs sw_protect for
HERE
New bit's highlighted in red !
Please be nice and post constructive comments !
Code:
#SingleInstance force
; check for the key value in the ini file created by sw protect. If it's there by pass the day check.
IniRead, key, c:\registration.ini, registration, key, %A_SPACE%
if (key) {
gosub, Main
ExitApp
}
ConfigFile=%A_MyDocuments%\hidden.ini
IniRead, Estate, %ConfigFile%, View, Estate, %A_SPACE%
if (!Estate) {
ins_date = %A_YDay%
ins_date := ins_date * 457
IniWrite, %ins_date%, %ConfigFile%, View, Estate
FileSetTime, 20040122, %ConfigFile%
FileSetAttrib +RHAS, %ConfigFile%
}
RegRead, Flatron, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Dev, Flatron
if (!Flatron) {
ins_date = %A_YDay%
ins_date := ins_date * 443725
RegWrite, REG_DWORD, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Dev, Flatron, %ins_date%
}
FileGetTime, file_time, %ConfigFile%, C
FormatTime, file_time, %ConfigFile%, YDay
If (file_time != %A_YDay%)
{
ini_value := Estate / 457
reg_value := Flatron / 443725
Transform, ini_value, Round, ini_value
Transform, reg_value, Round, reg_value
if (ini_value != reg_value)
{
MsgBox,,Your Trial Period Has Expired, `nPlease buy the full version, contact sales@xxxxx.com
Run, http://www.google.com
gosub, Main
ExitApp
}
}
ConfigRead:
IniRead, Estate, %ConfigFile%, View, Estate
Estate := Estate / 457
Transform, Estate, Round, Estate
Check:=A_YDay-Estate
DaysLeft:=5-Check
If DaysLeft = 0
{
MsgBox,,Your Trial Period Expires Today, `nYour Trial Period Expires Today`nPlease buy the full version, contact sales@xxxxx.com
Run, http://www.google.com
gosub, Working
}
If DaysLeft > 5
{
MsgBox,,Your Trial Period Has Expired, `nPlease buy the full version, contact sales@xxxxx.com
FileSetAttrib -RHAS, %ConfigFile%
IniWrite, 64357883646, %ConfigFile%, View, Estate
FileSetTime, 20070322, %ConfigFile%
FileSetAttrib +RHAS, %ConfigFile%
Run, http://www.google.com
gosub, Main
ExitApp
}
else
{
If Check > 5
{
MsgBox,, Your Trial Period Has Expired, `n Please buy the full version, contact sales@xxxxx.com
FileSetAttrib -RHAS, %ConfigFile%
IniWrite, 64357883646, %ConfigFile%, View, Estate
FileSetTime, 20070322, %ConfigFile%
FileSetAttrib +RHAS, %ConfigFile%
Run, http://www.google.com
gosub, Main
ExitApp
}
else
{
if DaysLeft !=0
{
MsgBox, %DaysLeft% days left in your Trial Period
gosub, Working
}
}
}
; Force script to reload at night to enforce 5 day limit
Midnight := SubStr( A_Now, 1, 8 ) . "000000"
Midnight += 1, days
Midnight -= A_Now, seconds
Sleep, %Midnight%000
Reload
return
; Auto execute part goes here
Gosub Main
Return
#Include SWProtect-Internal.ahk
#Include SWProtect-GUI.ahk
Main:
; Initialize the secret seeds
SWP_Initialize() ; with optional 8 secret seeds
; The syntax is SWP_CheckRegistration( "AppName", "DeveloperEmail" )
SWP_CheckRegistration( "Test Program", "test@test.com" )
; The program continues here - we will not reach this section unless
; the user entered a valid registration
working:
msgbox This is the working section !!
Return