Reads a password.


getpassword <filename> <password name> <strvar>


Retrieves an encrypted password identified by <password name> from the password file <filename>.
Decrypts the password and stores it into the string variable <strvar>.

If the specified file does not exist, it is newly created.
If the specified password is not stored in the file, the password dialog box appears and the entered password is stored in <strvar>.
At the same time, the new password is encrypted and written in the file with the identifier <password name>.

A password file can contain multiple passwords.
Each of them is identified by the password identifier.

(version 4.71 or later)
When the password file can not be written, the system variable "result" is set to 0. Otherwise, "result" is set to 1.


getpassword 'password.dat' 'mypassword' password
connect 'myhost'
wait 'login:'
sendln 'myname'
wait 'password:'
sendln password
expandenv str "%USERPROFILE%\myfile.dat"
getpassword str 'mypassword' password
if !result then
	messagebox 'Password was not saved' 'ERROR'

See also