Classic Notes Development; How to launch a database in Designer with Command Line Parameters
Ever wanted to launch a database directly in Designer? Yes, then you probably are a developer
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
Else
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.
Comments
designer.exe notes ://my.nsf/DemoForm?OpenForm
or
notes.exe notes: //my.nsf/DemoForm?OpenForm /DESIGNER
Notes.exe definitely takes parameters but might not honor the switch if a url is present.
stw
(no spaces between notes and ://)
Posted by Stephan H. Wissel At 16:29:30 On 07.05.2012 | - Website - |
Posted by Palmi At 16:36:40 On 07.05.2012 | - Website - |
Stephan: thanks, I'll try your tips!
Posted by Robert Ibsen Voith At 07:56:59 On 08.05.2012 | - Website - |
Posted by Robert Ibsen Voith At 10:57:47 On 08.05.2012 | - Website - |
designer.exe notes: //Server/ReplicaID/FormDesignElementUNID?OpenForm
Posted by Robert Ibsen Voith At 11:03:34 On 08.05.2012 | - Website - |
{ Link }
and
{ Link }
We open elements (any type) in Designer from the Notes clients in our courses.
Howard
Posted by Howard Greenberg At 17:20:18 On 08.05.2012 | - Website - |
Posted by Robert Ibsen Voith At 23:16:18 On 08.05.2012 | - Website - |