How to suppress this error message in the Lotusscript?

When this ws.AddDatabase(“ServerName”,“DBName”) is called in the LotusScript and the Server is obsolete due to migration, I would have a popup message “Server Error: File does not exist”. This error message prevents the script from further executing until a click on the message box. Is there anyway to prevent error message from popping?

Subject: How to suppress this error message in the Lotusscript?

If this line is not needed, rem it out…

'ws.AddDatabase(“ServerName”,“DBName”)

or remove it all together

Xie Xie

Subject: RE: How to suppress this error message in the Lotusscript?

Well, I have to have that line though, so that I know the icon is obsolete. Do you know a way to test if an icon is obsolete?

Subject: Lookup On Error, Err, Error in the help

There are several approaches, you could setup an:

On Error Resume Next

ws.AddDatabase(“ServerName”,“DBName”)

if Err then

…

exit sub

end if

Of course, if you have a value for ERR then you can test for that specific error code and do what ever.

Subject: RE: Lookup On Error, Err, Error in the help

I tried the “On Error Resume Next” idea. It does detect the error in the “if err” block. But the error message still pops for the AddDatabase line.

Subject: RE: Lookup On Error, Err, Error in the help

Can you not check the DB in the back-end class?

So something like:

dim DB as NotesDatabase

dim session as NEW NotesSession

DB = session.GetDatabase(“Server”, “DataBase”)

If Not(DB is nothing)

… 'Do your thing here

End If

Shawn

Subject: RE: Lookup On Error, Err, Error in the help

My purpose is to delete an obsolete icon, do you know how to do that?

Subject: RE: Lookup On Error, Err, Error in the help

You cannot remove anything from the user’s Workspace programmatically. Databases that are opened in the UI will be added automatically, but users will have to remove icons manually.

Subject: RE: Lookup On Error, Err, Error in the help

Thanks for your reply. I did some research and realized this is not some casual thing to do. Combined with code from a smart guy, I come up with the following:

On Error Resume Next



Call ws.AddDatabase("Server","DBName")

If Err >10 Then

Else

	keybd_event &h2e,0,0,0 ' Del key down

	keybd_event &h2e,0,2,0 ' Del key up

	keybd_event &h0D,0,0,0 ' Y key down

	keybd_event &h0D,0,2,0 ' Y key up

	

End If

This would work if the AddDatabase line does not let me go any further. That’s I was asking if there is a way to suppress error message popping by AddDatabase.

Any idea?

Subject: RE: Lookup On Error, Err, Error in the help

Well, too bad the SendKey doesn’t work within the notes client… you could maybe use a VBS script to send the keystrokes.

Example vbscript sends an Alt-Tab

set WshShell = CreateObject(“WScript.Shell”)

WshShell.SendKeys “%{TAB}”

Subject: RE: Lookup On Error, Err, Error in the help

Shigang zhang,

Are ‘Server’’ & ‘DBName’ variables? Do you have the right information stored in them about your server and database path & filename? If they are variables, then

Call ws.AddDatabase(Server, DBName) is the right one. It should not be Call ws.AddDatabase(“Server”, “DBName”)

Can you check them again?