Jump to content

one time lock


Recommended Posts

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 by Nukex1
Link to comment
Share on other sites

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 by dandymcgee

- Dan [Website]

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