When setting up Application Definitions (this used to be called scripting) quite often you will hit issues with handling message boxes which are generated by the application but are not easy to deal with.
These message boxes tend to look very similar. A title; which matches the name of the application; some text; describing the message or error; and a button.
When these dialogs appear the SecureLogin definition may have to take some sort of action. An example of this would be the message box which is displayed when the user sets up caching mode within GroupWise for the first time. Or a box telling the user that the password is incorrect which appears in front of the login window.
Many of these boxes are identical and have very similar formatting. This makes it more difficult for NSL to differentiate between them. The following box is a GroupWise message which shows a common set of properties:
There are 2 approaches to dealing with this. The first is to get the definition to react to all of the boxes and then work out what has to be done. This can be done using the following sort of dialog section.
Dialog Class #32770 Title “Novell GroupWise” EndDialog ReadText #65535 ?Message If “Remote Mailbox you have selected” –In ?Message MessageBox “The remote mailbox selected is incorrect. Please call the help desk.” Click #1 KillApp GroupWise.exe EndScript EndIf
Here the definition reads the message enclosed within the window and then reacts correctly to the text. This method of handling the errors tends to be my favourite as it can cope with almost any message and react appropriately. It does mean that a large number of If/EndIf statements are needed but these can be managed and written specifically for the messages that NSL is to handle.
An alternative approach is to create a Dialog/EndDialog section for each window. This is done by adding additional information to the window identifier. A piece of code which would handle the same window in this format would be:
Dialog Class #32770 Title “Novell GroupWise” Ctrl #65535 “The Remote Mailbox you have selected.*” EndDialog MessageBox “The remote mailbox selected is incorrect. Please call the help desk.” Click #1 KillApp GroupWise.exe EndScript
This appears much simpler and uses a regular expression to check the text displayed in the window as it appears on the screen. This has the advantage of only running when the specific window is on the screen but does mean that for each window of this type there has to be a specific Dialog/EndDialog section inside the definition and this will make the definition much longer and difficult to debug.