getpassword
Reads a password.
Format
getpassword <filename> <password name> <password var>
Parameters
- string <filename>
- Password file name.
- string <password name>
- Password identifier.
- string variable <password var>
- Variable to store the password.
Return Value
- System variable <result>
- When the password file can not be written, it is set to 0.
Otherwise, it is set to 1.
Remarks
Retrieves an encrypted password identified by <password name> from the password file <filename>.
Decrypts the password and stores it into the string variable <strvar>.
Password files created by Tera Term for Windows can be read and written as they are.
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.
Example
getpassword 'password.dat' 'foo' password connect 'myhost' wait 'login:' sendln 'myname' wait 'password:' sendln password
expandenv str "%HOME%/password.dat" getpassword str 'foo' password if !result then messagebox 'Password was not saved' 'ERROR' endif