change a variable in an app

i made this script, that will log me in automatically in World of Warcraft. since i did it to myself, i just placed my password in it. however i wanted to give it to some friends. but i dont want to create different scripts to each one of them. is there a way to make the script prompt a dialog box the first time, and change the variable “Password”? i dont understand much of applescript, but something like this:

if "password" is not defined
then show dialog "Input Password" --{or an input box, with the text "Input Password"}
and assign "Input Password" to variable "Password"
else run script --{normally?}

something like that, can anyone help me?
thank you


you can use something like this:

property PW : missing value

if PW is missing value then
	display dialog "Please enter password" default answer ""
	set PW to text returned of result
end if

Note: save the script as an application, then the persistence of the property is ensured

absolutely fantastic! thank you so much!
what you did was tell the application the “PW” could missing its value. then, if it was missing, you tell the app to open a dialog, to determine the value, if the value was already set, ignore the dialog command. is that right? i want to understand, so i can learn more :slight_smile:

Yes, almost :slight_smile: A value of a property in an application script is persistent also if the application will be quitted and restarted.
When you start the script the first time, the value is missing value which means it’s undefined.
After assigning the password to the property the value will be kept persistently unless you recompile the script