How?: "Ctrl-O" in Lotusscript

Howdy!

I’m sure I missed it somewhere, but I can’t seem to find how to use Lotusscript to do a “File - Database - Open”. I tried a couple of things in NotesUIWorkspace, NotesSession, but I can’t seem to find anything. It doesn’t seem like it’s a real hard thing to do, so maybe I’m just currently having a brain-fart or something. =8P Could there be an API for it?

This is what I want to do:

1.) from a Notes document, click the custom “Refresh Design” button,

2.) select a database (hence the “Ctrl-O”),

3.) read the notes document to add the new template version to the selected database (in step #2), and finally,

4.) refresh the design with the new template.

I have all of it done, but #2. =8|

Any ideas would be greatly appreciated!

Thanks, in advance,

Steve in NYC

“Weeks of coding can save you hours of planning.”

Subject: How?: “Ctrl-O” in Lotusscript

Two simple steps:1. Select your database

notesUIWorkspace.OpenFileDialog

  1. Then, with its server and filepath …

notesUIWorkspace.OpenDatabase

Subject: RE: How?: “Ctrl-O” in Lotusscript

  1. There isn’t a built and documented interface to do that exactly but you can easily do it yourself.

  2. You can use PE explorer to try to find the function in one of the dlls

If you want to press Ctrl-O you can do the following:

keybd_event &H11, &H9d, 0, 0

keybd_event VkKeyScan(Asc(“O”)), &H9e, 0, 0

keybd_event &H11, &H9d, &H2, 0

keybd_event VkKeyScan(Asc(“O”)), &H9e, &H2, 0

Subject: How?: “Ctrl-O” in Lotusscript

SendKeys(“^o”) and @Prompt([ChooseDatabase]) are the only two ways to do this. If you use SendKeys I don’t know how to capture the response since Notes won’t let you hook a window.

Subject: RE: How?: “Ctrl-O” in Lotusscript

Howdy!

Thanks to all who responded! In Designer, I did an “@Prompt(” to loop thru the options, but the “ChooseDatabase” wasn’t there. =8P Thanks for mentioning it! I looked at the documentation, and lo and behold… there it is!

So, now the trick is how to return the values in Lotusscript. Hmm… I’ll try an “evaluate”, and we’ll see how it goes.

Thanks to all!

Steve in NYC

Subject: Lotusscript way

Dim askme As VariantDim session As New NotesSession

Dim ws as New Notesuiworkspace

Dim searchdb as Notesdatabase

askme = ws.Prompt(13, “Database”, “Choose the database”)

If Datatype(askme) = 0 Then

Print “Cancelled”

End

End If

If Ubound(askme) > 0 Then

On Error Resume Next

Set searchdb = session.GetDatabase(askme(0),askme(1),False)

If searchdb.IsOpen Then

Print “Succesfully opened”

Else

AskDatabase = False

Msgbox(“Could not open target database”)

End If

End If

Subject: RE: Lotusscript way

Hello!

Of course! D’OH!!! If it’s a function, there’s usually some LS equivalent. =8P Thanks for saving me the trouble of looking.

Have a good weekend all!

Steve in NYC

“Artificial intelligence is no match for natural stupidity.”

Subject: How?: “Ctrl-O” in Lotusscript

I am not so sure you want the ctrl-O prompt since this will actually open the database - take a look at the OpenFileDialog method of UIWorkspace.