Hi all,

Having a spot of bother with a NSL 7 script for SAP 7.20 and wondering
if anyone has any insight.

When a user's password expires in SAP a change password dialog is
displayed (event A). We detect this dialog in our NSL script and call a
function to generate a new password and enter it, press tab, enter the
password again and then press enter.


Sub ChangeSAPPassword
ChangePassword ?PasswordNew random
Set ?PasswordOld $Password
Set $Password ?PasswordNew
Set $PwChanged ?currtime
Type ?PasswordNew
Type \T
Type ?PasswordNew
Type \N


The problem arises because we have many very slow machines in the estate
(especially our VMs) and the time it takes for NSL to react to the
password change box can vary greatly from almost instantly, to maybe 30
seconds. If during this time the user gets impatient and just presses
enter, then SAP pops up an error message indicating you have to enter a
valid password (event B). This error message takes focus and must be
closed before you can enter anything in the password change dialog.

Now what happens is that the slow running NSL script has already seen
event A for the change password box, so after a few moments it arrives
at the above code and it tries to enter the password but the focus is on
this error box instead. This doesn't really matter as such because the
input is thrown away. However the final 'type \n' acknowledges the error
and returns the user to the password change box.

However, event B has already been added to the NSL queue, and as we also
have logic in the script to detect the error message box appearing (in
response to mismatched passwords being entered for example), the NSL
scripts then performs its actions for this dialog which are simply
acknowledging the box by pressing enter. However we're no longer in that
error message dialog and are in fact back at the password change box, so
pressing enter just tries to change the password using a blank password,
and we get the error message displayed again !

I tried setting a variable in the code that detects the error box that
we could check in the change code, but this doesn't help because NSL
only processes one script at a time, so the error message code is not
triggered until after the password change code has all completed.

I did try using the "waitforfocus" command in our password change code
but this doesn't seem to notice that the focus has returned to the
original dialog. I have to manually click on the taskbar to activate
another program before it seems to wake up and notice this. So that's a
non starter as it would break all of the currently working password

Unfortunately I have no way of knowing that the password change was
carried out in the wrong dialog box, there is no message to say "you
have successfully changed your password" and it's not possible to read
in text from control ID data from the SAP client (it always returns
blank, possibly as the control ID is #0, I think this is due to the
java-ish nature of the SAP client)

Does anyone have scripts they have used to successfully handle password
change errors in SAP ?

clovercne's Profile: https://forums.netiq.com/member.php?userid=1699
View this thread: https://forums.netiq.com/showthread.php?t=46322