I found the following technique in a Visual Basic question in StackOverflow and adapted it for PB:
// Global Function f_IsSessionType(String as_session_type) returns Boolean
// Where as_session_type is any one of the following values (case does not matter):
// Citrix or Citrix Server
// Remote Desktop or Terminal Server
// Console or PC
Integer li_rc, li_num_values
String ls_values[]
ContextKeyword lcx_keyword
// Argument validation...
If IsNull(as_session_type) Then Return False
as_session_type = Lower(Trim(as_session_type))
If as_session_type = "" Then Return False
// Request a context service object...
li_rc = GetContextService("ContextKeyword",lcx_keyword)
If li_rc = 1 Then
// Request the value of the SessionName environment variable...
li_num_values = lcx_keyword.GetContextKeywords("SessionName",ls_values)
If li_num_values > 0 Then
// We're only interested in the first three characters of the first response value.
ls_values[1] = Mid(Upper(ls_values[1]),1,3)
// Is this a Citrix session?
If as_session_type = "citrix" Or as_session_type = "citrix server" Then
Return (ls_values[1] = "ICA")
// Is this a Remote Desktop session?
ElseIf as_session_type = "remote desktop" Or as_session_type = "terminal server" Then
Return (ls_values[1] = "RDP")
// Is this a Console (i.e., a PC) session?
ElseIf as_session_type = "console" Or as_session_type = "pc" Then
Return (ls_values[1] = "CON")
Else
Return False
End If
End If
End If
Return False
Disclaimer: I do not have access to a Citrix server or easy access to a Remote Desktop that I can install and test this function. It does however, recognize a PC/Console session. Please test it thoroughly.
Perhaps this will give you what you want without having to add and remember to configure an INI-file entry.
Best regards, John