anixon Posted April 16, 2007 Share Posted April 16, 2007 I am using setup2go to manage the installation and dismounting of an AutoIT application. Setup2go allows you to record and write keys to registry as well as ini files as part of the installation. This allows you to control and manage a setup process like making the script run on the re-boot after installation of the package. Sitting outside of the installing and dismounting process I want my configuration script each time it is launched by the installation process to write a permanent item into registry which increments that keys data field to record the number of times that the software has been installed/reinstalled on that local machine. I have no problems with writing that code, however given my limited knowledge of Registry can anyone suggest where I should create the key to recorded that data hklm\software\????\????\???? Assistance is always appreciated Ant.... Link to comment Share on other sites More sharing options...
Pakku Posted April 17, 2007 Share Posted April 17, 2007 (edited) I am using setup2go to manage the installation and dismounting of an AutoIT application. Setup2go allows you to record and write keys to registry as well as ini files as part of the installation. This allows you to control and manage a setup process like making the script run on the re-boot after installation of the package. Sitting outside of the installing and dismounting process I want my configuration script each time it is launched by the installation process to write a permanent item into registry which increments that keys data field to record the number of times that the software has been installed/reinstalled on that local machine. I have no problems with writing that code, however given my limited knowledge of Registry can anyone suggest where I should create the key to recorded that data hklm\software\????\????\???? Assistance is always appreciated Ant.... Hi, hklm\software\????\????\????isn't a bad place, you could use this for example: RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey", "REG_SZ", "Hello this is a test") oÝ÷ Úâ*.Ƭy«¢+Ø(ÀÌØíÙ±ÕôII ÅÕ½Ðí!-e}1= 1}5 !%9ÀäÈíM=Q]IÀäÈíQÍÐÅÕ½Ðì°ÅÕ½ÐíQÍÑ-äÅÕ½Ðì¤(ÀÌØíÙ±ÕôÀÌØíÙ±Õ¬Ä)I]É¥Ñ ÅÕ½Ðí!-e}1= 1}5 !%9ÀäÈíM=Q]IÀäÈíQÍÐÅÕ½Ðì°ÅÕ½ÐíQÍÑ-äÅÕ½Ðì°ÅÕ½ÐíI}MhÅÕ½Ðì°ÀÌØíÙ±Õ¤ you could also use HKEY_CURRENT_USER in place of HKEY_LOCAL_MACINE which will allow you to count for each user, you could also combine these two! Edited November 16, 2010 by Pakku How can someone use Windows without using AutoIt?That one would properly don't know how to handle a computer!My scripts:Send files over internetKind of RSS reader3Draw ProUDF: convert a character string to a binary one and backCalculate PiCommand line downloader (Youtube/Google video)Set the transparency of a window just by hitting a key!Secure your pcOther things:My filemanMy profilePM me Link to comment Share on other sites More sharing options...
hmsSurprise Posted April 17, 2007 Share Posted April 17, 2007 Hi, isn't a bad place, you could use this for example: RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Test", "TestKey", "REG_SZ", "Hello this is a test") oÝ÷ Úâ*.Ƭy«¢+Ø(ÀÌØíÙ±ÕôII ÅÕ½Ðí!-e}1= 1}5 !%9ÀäÈíM=Q]IÀäÈíQÍÐÅÕ½Ðì°ÅÕ½ÐíQÍÑ-äÅÕ½Ðì¤(ÀÌØíÙ±ÕôÀÌØíÙ±Õ¬Ä)I]É¥Ñ ÅÕ½Ðí!-e}1= 1}5 !%9ÀäÈíM=Q]IÀäÈíQÍÐÅÕ½Ðì°ÅÕ½ÐíQÍÑ-äÅÕ½Ðì°ÅÕ½ÐíI}MhÅÕ½Ðì°ÀÌØíÙ±Õ¤ you could also use HKEY_CURRENT_USER in place of HKEY_LOCAL_MACINE which will allow you to count for each user, you could also combine these two! Arjan Thanks for posting that Arjan! You just gave me a great idea about a problem I have been working on ( or stewing on in the back of my mind (a short walk)). jh Link to comment Share on other sites More sharing options...
anixon Posted April 17, 2007 Author Share Posted April 17, 2007 Thanks for that having a key called TEST might make it a bit obvious to an advanced user if you wanted to be a little bit more secure or secretative as to the intended use of the key. Is there any where in registry where software licence keys are usually written or in hklm can I call the key whatever I like without disturbing the general funcationality of the operating system? I like the way you have read incremented and written the data value. This is a bit of code that I have written which creates another encrypted licencing key . CODE #include<String.au3> ;Installation File $sidate = (_StringEncrypt(1, @YEAR & "/" & @MON & "/" & @MDAY & " " & "00:00:00", "yourencryptioncode", 1)) IniWrite(@WindowsDir & "\yourfilename.log", "section1", "value1", $sidate) ;Date Installed And the code that reads the licence CODE; #include "Date.au3" ;Check Licence $licence = (_StringEncrypt(0, IniRead(@WindowsDir & "yourfilename.log", "section1", "value2", "31"), "yourencryptionkey", 1)) $sStartDate = (_StringEncrypt(0, IniRead(@WindowsDir & "yourfilename.log", "section11", "value1", "2007/01/01 00:00:00"), "yourencryptionkey", 1)) $sEndDate = @YEAR & "/" & @MON & "/" & @MDAY & " " & "00:00:00" $days = _DateDiff ( "d", $sStartDate, $sEndDate) If ($licence - $days) < 6 and ($licence - $days)> -1 Then $message = " Licence will EXPIRED IN " & ($licence - $days) & " DAYS" DisplayMessage() EndIf If $days > $licence Then $message = " Licence has EXPIRED" DisplayMessage() ;your process EndIf 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