finitesimian
Programmer
I am in the process of creating a script that opens a dialog box for password entry. I need my dialog to be able to handle errors, and open itself back up again when they happen. Is there a way to do this?
Here is one example:
In this script, the user is attempting to enter and reenter the new password. The script needs to take the two passwords entered, make sure they match, and if they don't, pops up a messagebox, then repeats the dialog.
BTW-- in the help section, I noted a function called "Goto"--- will this work in this scenario?
Here is one example:
In this script, the user is attempting to enter and reenter the new password. The script needs to take the two passwords entered, make sure they match, and if they don't, pops up a messagebox, then repeats the dialog.
Code:
'above this line, all of the normal default declarations were made....
'----------------------------------------------
Dim password As String
password = "whatever_the_password_is"
Dim usrname As String
usrname = "test_user_1919"
'Begins dialog box for updating the password
Begin Dialog newdlg2 251, 54, "Updating password for: " & usrname
OkButton 194, 3, 50, 14
CancelButton 194, 21, 50, 14
TextBox NoEcho 100, 6, 79, 11, .TextBox2
TextBox NoEcho 100, 23, 79, 11, .TextBox22
Text 31, 6, 58, 9, "OLD PASSWORD:"
Text 31, 23, 62, 9, "NEW PASSWORD:"
TextBox NoEcho 100, 38, 79, 11, .TextBox221
Text 21, 38, 70, 9, "REPEAT PASSWORD:"
End Dialog
Dim mydialog2 As newdlg2
On Error Resume Next
'puts old password in first textbox
mydialog2.TextBox2 = passwrd
Dialog mydialog2
If Err=102 Then
Stop
End If
'obtains entries from dialog box
Dim pass1 As String
pass1 = mydialog.textbox22
Dim pass2 As String
pass2 = mydialog.textbox221
'compares the two
If pass1 <> pass2 Then
msgbox "Passwords do not match. Please reenter passwords"
'from here it needs to rerun the dialog box if possible
End if
'assuming it never triggered the error, it continues from here...
Sess0.Screen.MoveTo 1,2
Sess0.Sendkeys(pass1 & pass2 & "<Enter>")
stop
BTW-- in the help section, I noted a function called "Goto"--- will this work in this scenario?