Jump to content

Make a program expire


drdre
 Share

Recommended Posts

I have seen a lot of threads about adding trial periods etc. but was strugglingto integrate them into my program and they didn’t really fit what I was trying to do.

Background:I have a program that I wrote for my own use to automate data entry from excel intoour antique ERP system. By far the most useful script I’ve ever done, saving mearound 3-5 hours per week. A few of my colleagues asked if they could use so Imade them another version with a GUI and have continuously added functionality.Its grown from 200 to around 3000 lines now…My issue is that anotherdepartment have cottoned on to this program, asked for a copy (which I happilyprovided) and have now proceeded to marginalise my role in this particular aspectof my job role.

I want to maintain some aspect of control over my program use/updates, am I wrong to try and do this?? To clarify, I'm a business manager not in IT. I wasn't paid for this program. I'm happy let every one use it but don't want it to be used against me to marginalise my role in this particular activity.

I looked at using online validation but there are isolated copies. My only idea was a date stamp that had to be renewed by reading an encrypted key. Doesn't have to be complicated as most of the users can barely operate a PC.

cant get that code box to work!

license year/month/day will be stored in encrypted key file??

Func _LicenseChecker()

$LicenseYear = 2015

$CurrentYear = @YEAR

If $CurrentYear > $LicenseYear Then

_ShutDown()

EndIf

If $CurrentYear = $LicenseYear Then

_MonthCheck()

EndIf

EndFunc

Func _MonthCheck()

$LicenseMonth = 10

$CurrentMonth = @MON

If $CurrentMonth > $LicenseMonth Then

_ShutDown()

EndIf

If $CurrentMonth = $LicenseMonth Then

_DayCheck()

EndIf

EndFunc

Func _DayCheck()

$LicenseDay = 11

$CurrentDay = @MDAY

If $CurrentDay > $LicenseDay Then

_ShutDown()

EndIf

EndFunc

Func _ShutDown()

MsgBox(0, "Error", "License has expired")

;run activation program

Exit

EndFunc

Edited by drdre
Link to comment
Share on other sites

Not exactly what you're looking for, but here's a snippet I use. Simple to add a month and day check as well:

#include <date.au3>
If StringInStr($version, "beta") And StringLeft(_NowCalcDate(), 4) > 2011 Then
    MsgBox(48, "Expired verson", "This is an expired pre-release development version" & @CRLF & _
            "of this program and is not for general use." & @CRLF & @CRLF & _
            "Please email somebody@somewhere.com for further information.")
    Exit
EndIf

OR

#include <date.au3>
$expdate = Floor(_DateToDayValue("2011", "10", "11")) ;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

You might want to put the expiration date values into variables, too, instead of hard coding them... easier to change later.

Link to comment
Share on other sites

Look at this Function >>

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Not exactly what you're looking for, but here's a snippet I use. Simple to add a month and day check as well:

#include <date.au3>
If StringInStr($version, "beta") And StringLeft(_NowCalcDate(), 4) > 2011 Then
    MsgBox(48, "Expired verson", "This is an expired pre-release development version" & @CRLF & _
            "of this program and is not for general use." & @CRLF & @CRLF & _
            "Please email somebody@somewhere.com for further information.")
    Exit
EndIf

OR

#include <date.au3>
$expdate = Floor(_DateToDayValue("2011", "10", "11")) ;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

You might want to put the expiration date values into variables, too, instead of hard coding them... easier to change later.

Thanks for this!

Me being stupid, tried something silimar to start with but couldnt get it to work.

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