Nukex1 Posted July 3, 2008 Share Posted July 3, 2008 (edited) my program will work and work until you restart your computer I want it to be only used once unless they know autoit ofc muttley if they know autoit they deserve to use it again so something like this I hope you get it if lock = 1 then it can be used and when the func get used it turn lock = 0 how do I do that? also I dont want the program to stop working while its turned on just because it turns the lock = 0 Edited July 3, 2008 by Nukex1 Link to comment Share on other sites More sharing options...
Zedna Posted July 3, 2008 Share Posted July 3, 2008 Create some registry key and set its value in OnAutoItExit() Also test this value at start of your script. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Nukex1 Posted July 3, 2008 Author Share Posted July 3, 2008 this is done without having to install anything right? Link to comment Share on other sites More sharing options...
dandymcgee Posted July 3, 2008 Share Posted July 3, 2008 (edited) this is done without having to install anything right? Install? You can use the registry functions in autoit to create a new entry in the registry (ex. "lock" with value 1) and then RegRead() that entry at the start of the program, exiting if equal to 1. Example: $LockStatus = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Lockout", "Lock") If $LockStatus = 1 Then MsgBox(0, "Error", "This program cannot be run again", 2) Exit Else RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Lockout", "Lock", "REG_DWORD", 1) EndIf ;Actual Program Here MsgBox(0, "Testing", "Congrats this is your first time running this program.") Edited script for clarity. Edited July 3, 2008 by dandymcgee - Dan [Website] 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