Jump to content

Please help me with making a trial version


Renaito
 Share

Go to solution Solved by Renaito,

Recommended Posts

Hello there

I am just beginning at this and decided to make my own script ( an easy one ) but will try to improve my skills and make a good one in future, meanwhile I was trying to learn how to make a trial version, to send it to my friends or share it with other people

Ive been searching for everything in the forum, also tried XProtec but didn't work as I wanted :<

I found this useful :

But it has some things to fix

This is the original code in that post:

$Expiration= 5   ;Expiration time in minutes
$Expiratoin= $Expiration * 1000 * 60
If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey") = 0 Then;Checks if it has been ended
MsgBox(0,"Expired!","Expired!")
Exit
EndIf
$timer=TimerInit()
While 1
If $timer > $Expiration Then
MsgBox(0,"Expired!","Expired!")
Exit
End If
Wend
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey", "REG_SZ", "0")

I edited it like this:

$Expiration= 5   ;Expiration time in minutes
$Expiration= $Expiration * 1000 * 60
If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey") = 0 Then;Checks if it has been ended
MsgBox(0,"Expired!","Expired!")
Exit
EndIf
$timer=TimerInit()
While 1
If $timer > $Expiration Then
MsgBox(0,"Expired!","Expired!")
Exit
EndIf
Wend
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey", "REG_SZ", "0")

My problems are the following:

It says expired when I hadnt even used it yet

Note: I tried the exe in another computer and shows expired in the first time its opened.

 

Any clue where I should edit it ? Been searching many ways for 4 hours or more but can't find anything to fix or any other code that could help me.

All I want is to prevent the other users to use it after the trial period is over,  because I tried another way, but I changed the system date and it was still working so no point using it x_x

Thanks in advance!

Link to comment
Share on other sites

you need to use timerdiff($timer) > $expiration

also, I don't believe your script will ever hit the regwrite line as it is after the infinite loop.

*edit*

as for the switching computer time, you could have your program check the pcs time against the internet to check if the computer's date has been changed.

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

you need to use timerdiff($timer) > $expiration

also, I don't believe your script will ever hit the regwrite line as it is after the infinite loop.

*edit*

as for the switching computer time, you could have your program check the pcs time against the internet to check if the computer's date has been changed.

 Hello kaotbliss, thanks for your reply

I want is to make the script work for 1 hour and then dont work anymore, but I tried everything in the previous code and still says it expired

Mind you guide me to do it? 

In the other hand, What you suggested was likee this right?

Here are the search I did so far:

And Also I tried this one:

#include <date.au3>
$expdate = Floor(_DateToDayValue("2014", "01", "31")) ;Julian date since (days since noon 4713 BC January 1)
If (Floor(_DateToDayValue(@YEAR, @MON, @MDAY)) > $expdate) Then
        MsgBox(0, "Error", "License has expired")
         ;run activation program
         Exit
EndIf

Its working but It doesnt block the script when the user changes the date ( days or months before the expiration date)

Or is that code able to be edited and add the one posted here?

Sorry, I'm really doing my best to understand this but I feel like a dumb.

Edited by Renaito
Link to comment
Share on other sites

Bump.

Could someone explain me another way or how does this work :

Because I added the code and everything is okay, but seems like I dont know where Is the correct line

It drops me an error in line 6101 -> Unknown function name

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <Date.au3>
#include <String.au3>
#include <INet.au3>
;~ TEST
$sScript_Name = "Test1"
If RegRead("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name) = "" Then
    RegWrite("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name, "REG_SZ", _StringEncrypt(1, _NowCalc(), @ComputerName))
    SetError(0)
EndIf

$sStartDate = _StringEncrypt(0, RegRead("HKCU\Software\Microsoft\Windows\Current Version", $sScript_Name), @ComputerName)

$diff_Web = _DateDiff("D", $sStartDate, _WebTime())
$diff = _DateDiff("D", $sStartDate, _NowCalc())

If $diff_Web <> $diff Then
    MsgBox(0, "Aha", "Caught you!")
    Exit
EndIf

$iErrorCount = 0

While 1

    $iPing = Ping("www.uhrzeit.org")

    If @error Then
        TrayTip("Date Checker", "Connection Failed" & @CRLF & "Retrying in 5 secs", 5)
        Sleep(5000)
        $iErrorCount += 1
        If $iErrorCount > 10 Then
            TrayTip("Date Checker", "No Connection" & @CRLF & "Exiting....", 5)
            Sleep(5000)
            Exit
        EndIf
    Else
        TrayTip("Date Checker", "Connected" & @CRLF & "Reading date", 5)
        Sleep(2000)
        ExitLoop
    EndIf
WEnd

$sSource = _INetGetSource('http://www.uhrzeit.org/atomuhr.html')

TrayTip("Date Checker", "Connected" & @CRLF & "Reading date", 5)

$aDate = _StringBetween($sSource, '<div id="anzeige_datum">', '</div>')
$sDate = $aDate[0]
$aDate = StringSplit($sDate, " ")

$sYear = $aDate[4]
$sDate = StringTrimRight($aDate[2], 1)
$iMonth = 0

Switch $aDate[3]
    Case "Januar"
        $iMonth = 1
    Case "Februar"
        $iMonth = 2
    Case "März"
        $iMonth = 3
    Case "April"
        $iMonth = 4
    Case "Mai"
        $iMonth = 5
    Case "Juni"
        $iMonth = 6
    Case "Juli"
        $iMonth = 7
    Case "August"
        $iMonth = 8
    Case "August"
        $iMonth = 9
    Case "Oktober"
        $iMonth = 10
    Case "November"
        $iMonth = 11
    Case "Dezember"
        $iMonth = 12
EndSwitch

TrayTip("Date Checker", "", 1)
MsgBox(0, "Today's Date", $sDate & "/" & $iMonth & "/" & $sYear)

Don't know where the error is, or what is wrong >.<

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...