drdre Posted November 23, 2011 Share Posted November 23, 2011 (edited) 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 = @YEARIf $CurrentYear > $LicenseYear Then _ShutDown() EndIfIf $CurrentYear = $LicenseYear Then _MonthCheck()EndIfEndFuncFunc _MonthCheck()$LicenseMonth = 10$CurrentMonth = @MONIf $CurrentMonth > $LicenseMonth Then _ShutDown()EndIfIf $CurrentMonth = $LicenseMonth Then _DayCheck()EndIfEndFuncFunc _DayCheck()$LicenseDay = 11$CurrentDay = @MDAYIf $CurrentDay > $LicenseDay Then _ShutDown()EndIfEndFuncFunc _ShutDown()MsgBox(0, "Error", "License has expired");run activation programExitEndFunc Edited November 23, 2011 by drdre Link to comment Share on other sites More sharing options...
Dana Posted November 23, 2011 Share Posted November 23, 2011 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 More sharing options...
guinness Posted November 23, 2011 Share Posted November 23, 2011 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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
drdre Posted November 23, 2011 Author Share Posted November 23, 2011 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now