password protected settings script Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ChadMcCabe
Posts: 6
Joined: 29 Aug 2022, 10:00

password protected settings script

07 Jan 2023, 20:19

I am looking to create a settings ( configuration part of a script hidden by a hotkey and then a password after hotkey press )

so in effect the script is running and if I were to say press cntrl a I would then get a popup asking for a password that would then upon correct password

That would then allow the owner / operator ( not the user unless given the hotkey and password ) to change the settings below

1) Test.ini or Test.txt file name and location
2) download save location ( for file downloaded )
3) settings hotkey
4) settings password

If I am asking a lot again my apologies I am very new to AHK and looking to learn and experiment so if its a lot to code I understand if someone just wants to direct me to where I can learn to make this possible that would be great as well but if someone wanted to take the time to code it so I could run it and play with the code to learn from it that would be great as well

thank you for your time and assistance
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: password protected settings script  Topic is solved

08 Jan 2023, 03:32

This is the password part

Code: Select all

p:: ; trigger with a hotkey of p
pass := "apassword" ; set the password
maxTries := 3 ; how many tried will you let the user make before you take some special action
tried := 0 ; keep track of how many tries they make
while(thePass != pass && tried < maxTries){ ; use a while loop to check if they didn't enter the right pass AND they didn't max out tries
	InputBox, thePass, Login, Enter The Password ; prompt for the password
	if (thePass = pass) { ; check if they entered the right pass
		MsgBox, good password`, write your code here to bring up your gui with the settings 
	} else {
		tried++ ; increase the tried variable by 1
		if (tried < maxTries){ ; this part will let you have a special message for them on their last try so they know what to do
			MsgBox, % "wrong password " tried " of " maxTries " attempts" ; tell them how many tried they have left so they try harder to remember the pass
		} else {
			MsgBox, % "wrong password " tried " of " maxTries " attempts. Contact Support for Help"
		}
	}
}
ExitApp


Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 207 guests