« Classic Notes Development - Access Search Bar from LotusScript | Main| Classic Notes Development: Updated code to open design elements from Notes - in Designer »

Classic Notes Development; How to launch a database in Designer with Command Line Parameters

Tags: LotusScript

Ever wanted to launch a database directly in Designer? Yes, then you probably are a developer Smilefjes

Read more to see a snippet of LotusScript code on how to launch the Designer with a specified database.

BTW – wish I could specify a specific designer element, so if you know, please chime in.

The following code assume that you have placed the code in an action button in a view, and that you have selected a document with the fields txtServer and txtFilePath available. You can of course replace this with whatever you want.

Sub Click(Source As Button)
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim coll As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim strNotesDir As String
    Dim strCmdAndParam As String
    Dim strServer As String
    Dim strFilePath As String
    On Error Resume Next
    strNotesDir = Fulltrim(session.GetEnvironmentString("NotesProgram",True))
    If Len(strNotesDir) = 0 Then Exit Sub
    If Right(strNotesDir, 1) <> "\" Then strNotesDir = strNotesDir & "\"
    Set db = session.CurrentDatabase
    Set coll = db.UnprocessedDocuments
    If coll.Count = 0 Then Exit Sub
    Set doc = coll.GetFirstDocument
    strServer = Fulltrim(doc.txtServer(0))
    strFilePath = Fulltrim(doc.txtFilePath(0))
    If Len(strFilePath) = 0 Then Exit Sub
    If Len(strServer) > 0 Then
        strCmdAndParam = strServer & "!!" & strFilePath
        strCmdAndParam = strFilePath
    End If
    strCmdAndParam = |"| & strNotesDir & |designer.exe" "| & strCmdAndParam  & |"|
    Dim result As Integer
    result = Shell(strCmdAndParam, 1)
End Sub

The code first get the NotesProgram-keyword from Notes.ini, and based on that, boldly assumes that you have designer.exe in the same directory. This means that the code won’t work if;

a) It can’t find NotesProgram keyword in Notes.ini

b) You don’t have “designer.exe” in the program directory. This means that you’d probably need some version of Lotus Notes 8 in order to get this to work.

Note that all hope isn’t gone for elder versions of designer. Remember you can always start notes.exe with the command line parameter /DESIGN too. This have however not been tested.


Gravatar Image1 - Did you try to launch designer with a Notes URL on the command line? something like:
designer.exe notes ://my.nsf/DemoForm?OpenForm
notes.exe notes: //my.nsf/DemoForm?OpenForm /DESIGNER

Notes.exe definitely takes parameters but might not honor the switch if a url is present.

Emoticon stw

(no spaces between notes and ://)

Gravatar Image2 - Does Right mouse click on tab and select desinger do the same ?

Gravatar Image3 - Palmi: yes of course. My code above is simply used from another database containing database synopsises for many databases. Then it is nice to launch the selected database directly instead of having to open it first.

Stephan: thanks, I'll try your tips!

Gravatar Image4 - Stephan: I tried your suggestion, but Designer would only open up the database in designer, and the default designer-view (forms). It wouldn't open the specified form.

Gravatar Image5 - Stephan!! But it worked when I used the UNID of the form (in other words, I didn't use the form name). For example the URL looked like this;

designer.exe notes: //Server/ReplicaID/FormDesignElementUNID?OpenForm

Gravatar Image6 - See these two resources:

{ Link }


{ Link }

We open elements (any type) in Designer from the Notes clients in our courses.


Gravatar Image7 - Howard: THANKS for your links! I now have code that open my design elements at will. I'll repost the code tomorrow!

Post A Comment