Very simple LotusScript function to parse value on url line

Below Is a very simple LotusScript code function that assumes that there is only one parameter such that the url is something like

1
"http://domain.com/path/database.nsf/pathtoMyAgent/MyAgent?OpenAgent123"

, where 123 is the parameter value you are looking for

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Function ExtractPassedParameter As String
'========================================================
' This routine parses parameters sent to the agent in the
' command line. to the right of the &
'========================================================

Dim paramdoc As NotesDocument
Dim pathinfo, param As String
Dim eq As Integer

Set paramdoc = ses.documentcontext

pathinfo = paramdoc.PATH_INFO(0)

eq = Instr(pathinfo,"&")
If eq = 0 Then
ExtractPassedParameter = ""
Exit Function
End If

' discard every before the first &
param = Right(pathinfo,Len(pathinfo)-eq)

ExtractPassedParameter = Ucase$(param)

End Function

This is old code, I’ve used for a looong time (maybe back in the EVI days?) . I don’t know If I wrote it or stole it from someone smarter than me.

Leave a Reply