TypePasswordKeys Method

Class

AnyWin.

Action

Sends an encrypted password to a control. TypePasswordKeys is supported for the following technology domains:
  • Win32: You can use the TypePasswordKeys method on password fields, which are text fields with the boolean property IsPassword set to "true".
  • Windows Forms: You can use the TypePasswordKeys method on password fields, which are text fields with the boolean property IsPassword set to "true".
  • Java SWT: You can use the TypePasswordKeys method on password fields, which are text fields with the boolean property IsPassword set to "true".
  • WPF: You can use the TypePasswordKeys method on controls of the type WPFPasswordBox.
  • Swing: You can use the TypePasswordKeys method on controls of the type JPasswordField and on AWTTextField controls that have the boolean property IsPassword set to "true".
  • xBrowser: You can use the TypePasswordKeys method on on controls of the type DomTextField that have the boolean property IsPassword set to "true".
  • SAP: You can use the TypePasswordKeys method on on controls of the type SAPTextField that have the boolean property IsPassword set to "true".

Availability

This functionality is supported only if you are using the Open Agent.

Syntax

window.TypePasswordKeys (sEncrypted [, nDelay, ensureFocus])
Variable Description
sEncrypted The encrypted password. STRING.
nDelay Optional: The delay between keystrokes (in seconds and fractions of seconds). NUMBER.
ensureFocus

Optional: Whether the agent brings the application to the foreground and then sets the keyboard focus to the control on which the method is executed. This is executed before the first key is typed, which means it is not rechecked for each keystroke when you specify multiple keys to be typed.

By default, this variable is set to TRUE. BOOLEAN.

Notes

  • Calling TypePasswordKeys on an encrypted text has the same effect as calling the Encrypt method on the plain text and then calling the TypeKeys on the outcome.
  • When the password changes you can call the Encrypt method to encrypt the new password and then replace the encrypted text in the TypePasswordKeys statement.
  • On Windows, TypePasswordKeys first gives the window input focus before typing into it.
  • If you specify nDelay, that value overrides the value set with the OPT_KEYBOARD_DELAY option, which you set with SetOption.
  • A key can be followed by a counter, which defines how often the keys should be typed. The counter can be combined with the delay.
  • During the delay time, the screen is locked and interaction with the mouse and keyboard is no longer possible.
  • When recording with the DOM extension TypeKeys ("<Tab>") will not be captured. Since the script refers to object to type in directly, it is not necessary to record this manual Tab. You can manually enter a TypeKeys ("<Tab>") into your script if you want to; it just will not be recorded.
  • When specifying groups of keys, such as Ctrl-Shift, the Classic Agent only supports minus signs (-) as a delimiter between key names while the Open Agent supports plus and minus signs.

Example

The following code encrypts a string and prints it to the console:
STRING encryptedPassword = Encrypt("my password")
Print(encryptedPassword)
You can then copy the encrypted password from the console, in this case 6Fk+Bcm+GoXe3X0=, and use it as follows:
textField.TypePasswordKeys("6Fk+Bcm+GoXe3X0=")