Jump to content

AppTrial Module


MrCreatoR
 Share

Recommended Posts

Hi,

First of all i want to make it clear: This is only a concept, not a ready module to work with.

I have never thought, or make any kind of research about how these stuff done by proffesional developers, so this is only a logic concept of how i see it. It probably could/should be more complicated and disguised, but as i said, it's only a concept.

This module should allow to make your software work as «"n" Days Trial», so when the time is over, user will be prompt about entering a Product Key (wich is generated for current computer and it's system - just a simple algorithm, to allow the same generation process on server's side (to get purchased product key)).

Example:

#include <AppTrialModule.au3>

$n_APPTRIAL_EXPIRED_VALUE   = 24
$n_APPTRIAL_MODE            = 3 ;>= 1 seconds, >= 2 Minutes, >= 3 Hours, >= 4 Days.

$s_APPTRIAL_TITLE           = "My Software" ;This will be used in Registry entry and other places
$s_APPTRIAL_MSG             = "Your trial period (%s hours) has been expired."
$s_GET_PRODUCT_KEY_URL      = "http://my-web-site.com/app_registration.html"

;We set AppTrial Module on 24 hours
_SetAppTrial_Module()

Switch @extended
    Case 0
        MsgBox(48, $s_APPTRIAL_TITLE & " - Trial Version", _
            StringFormat("You still can use this program, you have left <%s> hours :) ", _
                $n_APPTRIAL_EXPIRED_VALUE - Round($n_APPTRIAL_OVERTIME, 1)))
    Case 1
        MsgBox(64, $s_APPTRIAL_TITLE & " - Full Version", "This is full version, thank you for buying our software.")
EndSwitch

MsgBox(64, $s_APPTRIAL_TITLE, "The program working (for now? :) )...")

Attachments:

AppTrialModule.zip

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 6 months later...

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=..\..\..\..\..\..\Program Files\AutoIt3\Aut2Exe\Icons\SETUP03.ICO
#AutoIt3Wrapper_outfile=testtrial.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <AppTrialModule.au3>

$n_APPTRIAL_EXPIRED_VALUE   = 5
$n_APPTRIAL_MODE            = 3 ;>= 1 seconds, >= 2 Minutes, >= 3 Hours, >= 4 Days.

$s_APPTRIAL_TITLE           = "jajaBING" ;This will be used in Registry entry and other places
$s_APPTRIAL_MSG             = "Your trial period (%s hours) has been expired."
$s_GET_PRODUCT_KEY_URL      = "http://my-web-site.com/app_registration.html"

$keyyyy = _AppTrial_Generate_ProductKey()
ConsoleWrite($keyyyy)

;We set AppTrial Module on 24 hours
_SetAppTrial_Module()

Switch @extended
    Case 0
        MsgBox(48, $s_APPTRIAL_TITLE & " - Trial Version", _
            StringFormat("You still can use this program, you have left <%s> hours :) ", _
                $n_APPTRIAL_EXPIRED_VALUE - Round($n_APPTRIAL_OVERTIME, 1)))
    Case 1
        MsgBox(64, $s_APPTRIAL_TITLE & " - Full Version", "This is full version, thank you for buying our software.")
EndSwitch

MsgBox(64, $s_APPTRIAL_TITLE, "The program working (for now? :) )...")

I know this is not a 100% working module but at least I know I can try.

I set expiry in hours try to look if its really work.

I tried and run it but after the second time, I had to put serial code because it's already expired?

Link to comment
Share on other sites

What do you mean this is not a ready module to work with? Works fine for me?

It was my _StringEncrypt function doesn't work properly. When I decrypt it, it always give me

"b" or "bc" as a result. So, it didn't work for me.

Btw, I changed it and use it with Crypt.au3, and it worked wonderfully.

thanks.

Link to comment
Share on other sites

I guess it is just a concept because of the lack of security. In reality, it is just a single file holding the settings with some backups of that file in various different locations. But I am with you Hypertrophy, I don't care. I think it is great and ready to use the way it is. It has plenty of security for use on the average computer. Most people wouldn't be able to find the files (at least not the people in my family).

Link to comment
Share on other sites

MrCreator, I'm trying to use it with the registration part and I don't understand how the Product Key is given to each individual user. It should be different per user and I don't even know how to generate it properly and the process of using this module to do registration. Can anyone help me?

And thank you so much for this cool tool to incorporate trials into scripts. God Bless.

Edit: Does this trial only go on when the program is running? Does it continue counting even when it's not running. Because it says I have 16.8 days left and i started the trial 3 days ago? PLEASE HELP

Edited by Hypertrophy
Link to comment
Share on other sites

how the Product Key is given to each individual user.

After the user is registered, you can send him this path:

$sProductKey = InputBox( _
    "Product Key Generator for <My Software>", _
    "Please press [OK] to copy your Product Key:", _AppTrial_Generate_ProductKey(), "", 300, 130)
If Not @error Then ClipPut($sProductKey)

Func _AppTrial_Generate_ProductKey()
    Local $sRet_PK
    Local $sPK_Val = @ComputerName & @UserName & @CPUArch & @IPAddress1 & @OSType & @OSArch & @OSLang & @OSBuild & @OSVersion
    Local $aSplit_PK = StringSplit(StringUpper(StringRegExpReplace($sPK_Val, "(?i)[^a-z0-9]+", "")), "")
    
    For $i = $aSplit_PK[0] To 1 Step -3
        If Mod($i, 5) = 0 Then
            $sRet_PK &= $aSplit_PK[$i] & "-"
        Else
            $sRet_PK &= $aSplit_PK[$i]
        EndIf
    Next
    
    Return StringRegExpReplace($sRet_PK, "-+$", "")
EndFunc

Or you can encrypt with password the key and give the password to registered users, so they will be able to generate the Product Key inside the trial software (using the same path concept as above).

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

And does this trial only go on when the program is running? Because I started the trial at 17 days and today (a week later from when i started it) it nows says I have 16.7 days left.

Well yes, it's counting the days the program been runing, so it's kind of a N-runs (days) trial :D

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Well yes, it's counting the days the program been runing, so it's kind of a N-runs (days) trial :D

I don't think you understand. It's not counting the days the program has been running. Its counting how long the program runs each time and then eventually expires. But this way if a trial is set to 10 days it could be more like a 3 month trial depending how often they use the program. See where I'm coming from?

Link to comment
Share on other sites

See where I'm coming from?

Yes, this what i meant when i said «it's kind of a N-runs (days) trial».

It's collecting the total time it's been runing.

And BTW, it's not by design, i had no intention to make this kind of behaviour, i will have to check this issue...

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

You could probably store the start date in the registry (in some hidden/encrypted form) and check against that every time program run.

If the user deletes the key or change the clock backward the trial period automatically ends.

Can you do that ?

Link to comment
Share on other sites

You could probably store the start date in the registry (in some hidden/encrypted form) and check against that every time program run.

If the user deletes the key or change the clock backward the trial period automatically ends.

Can you do that ?

Hm, it's strange, i have checked the code, and it's counting using TimerInit, so it's supose to be expired after number of set days, because it's not related to the system date and to the software run process, the timer does not "care" how long the program was runing...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Am sorry for a stupid question, but:

i added in the AppTrialModule.au3

InputBox ("Product key generator","This is your product Key",_AppTrial_Generate_ProductKey())

to get the code required for activation.

I understand that this code is only valid for the machine on which it was generated. How do i generate the code on my machine so that the end user will have it valid on his machine ?

Am not sure how to give correct code to end user without end user to provide me with all the information scripts needs from his machine.

Maybe there is some sort of request code from which i can generate the key that will activate the product on his particular machine ?

I also dont see how to play with this code.

How does it know it expired, where does it store the data on my computer for me to delete it so i can play with time values and see how it effects the script.

Thank you in advance.

Edited by dirty
Link to comment
Share on other sites

  • 1 year later...

Hello to everyone,

I am new on the forum, and rookie on autoit. My opinion is that this is certainly best way to protect your work - thanks to MrCreatoR. My simple solution is to add this code in your script:

#include <Crypt.au3>

Local $CRYPT_KEY = 78291492817  ; I used some random number here


$sHOST = @ComputerName & @UserName & @CPUArch & @IPAddress1 & @OSType & @OSArch & @OSLang & @OSBuild & @OSVersion

$FILE_HANDLER = FileOpen("HOST", 2)
FileWrite($FILE_HANDLER, _Crypt_EncryptData($sHOST, $CRYPT_KEY, $CALG_RC4))
FileClose($FILE_HANDLER)

Now, anytime and anywhere your program was run, he will make encrypted HOST file. When user want to register his copy of program, he just need to send HOST file to you and you then make key for him using this simple code:

#include <Crypt.au3>

Local $CRYPT_KEY = 78291492817  ; Same number like in HOSTGENERATOR
Global $sPK_Val


$FILE_VAL_HANDLER = FileOpenDialog("Find Host File", @ScriptDir&"\", "All (*.*)" , 1+2, "HOST")
If @error = 1 Then
   MsgBox(00, "","You choose to cancel this operation.")
   Exit
EndIf
$ENCRYPTED_DATA = FileRead($FILE_VAL_HANDLER)
$sPK_Val = BinaryToString(_Crypt_DecryptData($ENCRYPTED_DATA, $CRYPT_KEY, $CALG_RC4))


$sProductKey = InputBox( _
    "Product Key Generator for <My Software>", _
    "Please press [OK] to copy your Product Key:", _AppTrial_Generate_ProductKey(), "", 300, 130)
If Not @error Then ClipPut($sProductKey)

Func _AppTrial_Generate_ProductKey()
    Local $sRet_PK
    Local $aSplit_PK = StringSplit(StringUpper(StringRegExpReplace($sPK_Val, "(?i)[^a-z0-9]+", "")), "")
    For $i = $aSplit_PK[0] To 1 Step -3
        If Mod($i, 5) = 0 Then
            $sRet_PK &= $aSplit_PK[$i] & "-"
        Else
            $sRet_PK &= $aSplit_PK[$i]
        EndIf
    Next
    
    Return StringRegExpReplace($sRet_PK, "-+$", "")
EndFunc

Maybe this is not best solution if you do not have your private server or site, where the HOST files will be uploaded, but it will work for some time.

Link to comment
Share on other sites

I have some questions for MrCreatoR,
 
What I need to do for delete settings that was made by AppTrialModule, and how to delete temporary files? You see, if somebody try to check developed program couple times, he need to reset settings to see how its works. When I was download AppTrialModule, I used example to see how that working, and now every times I extract data again, an try to open example program, he simple sais that's time is over, and asks for SERIAL again. How the hell to reset that, and delete created files from registry?
 
Sorry for my bad english, :unsure:
Best regards.

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