Extracting the user name without it returning the server name

How do you phrase an evaluate statement to extract the user name without it returning the server name or the name of the person who signed the agent?

I have the following code, which I thought would do the trick, but it continues to return my name (the agent signer) rather than the logged-in user name:

:
macro = |@ReplaceSubstring(@ReplaceSubstring(@Name([Abbreviate]; @UserName); " "; "_"); "/"; "-")|
	dummy =  Evaluate(macro) 'Evaluate is used to skip server name
	uname=dummy(0)	
	key = dummy(0) & "_" & "OPEN"

If you are running the agent over the Web, this is actually fairly simple and you won't need Evaluate. You simply use the Remote_User CGI variable. A simple LotusScript example follows: Dim nsCurrent as New NotesSession Dim ndocWeb as NotesDocument Dim strUser as String Set ndocWeb=nsCurrent.DocumentContext strUser=ndocWeb.Remote_User(0)

This was first published in May 2002