This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


Feb 23, 2018, 8:02 PM
2 Posts

LotusScript Code

  • Category: Application Development
  • Platform: All Platforms
  • Release: 9.0.1
  • Role: End User
  • Tags: lotusscript
  • Replies: 2

I have search the site but can't find what I am looking for.

I have a DB with ranges of IP addresses to track our servers.  On the form, is a button to ping the server. 

You click it, it pulls the IP address from the form and then executes the following code.

Dim session As New NotesSession
    Dim platform As String
    platform = session.Platform
    Dim ui As New NotesUIWorkspace
    Dim doc As NotesDocument
    Set doc = ui.CurrentDocument.document
    Dim ip As String
    Dim result As Integer
    ip =  doc.IP(0)    
    If platform = "Windows/64" Then
        Print platform
        result = Shell("ping -a -t  -n 5 " & ip, 1)        
    Elseif platform = "Windows/32" Then
        Print platform
        result = Shell("ping -a -t -n 5 " & ip, 1)
    Elseif platform = "Macintosh/64" Then
        Print platform
        REM result = Shell("ping -c 5 " & ip, 1)
        Messagebox "Still trying to get this to work on the Mac!" , MB_OK, "DUH!!!!"
    Elseif platform = "UNIX" Then
        Print platform
        Messagebox "Still trying to get this to work on LINUX!" , MB_OK, "DUH!!!!"
        REM result = Shell("/usr/bin/ping", 1)
    Else
        Messagebox platform & " is not currently supported.", MB_OK, "Opps!!!"
    End If

Works great under Windows using the SHELL function.  But apparently, the SHELL function only works under Windows???

Does anyone have the required LotusScript code to get the ping command to work under RHEL or MAC?

Thanks,

Joe

PS...I had to comment out the code.  It tends to lock up the MAC and RHEL systems, depending on what switches are included with the ping command.

 

Feb 26, 2018, 6:15 PM
107 Posts
Here's what works for me under Ubuntu
Sub Initialize
       On Error Goto CatchAll
       
       Dim retVal, ip$
       ip = {xx.xx.xx.xx} 'Your IP goes here

       retVal = Shell({gnome-terminal -e '/bin/ping -c 5 } & ip & {'}, 1)
       Msgbox "Shell returned: " & retVal
       
       Exit Sub
CatchAll:
       Msgbox Err() & " - " & Error$() & ", line " & Erl()
       Exit Sub
End Sub


What did the trick was opening a terminal (gnome-terminal in my particular example, but could be any other as well) and let that terminal execute the script.

I guess similar approaches would work under RHEL and OSX as well. Can't test, however, since I have no suitable boxes at my fingertips.
Feb 28, 2018, 6:20 PM
2 Posts
Thanks for the help!

Thanks Jochen!  That worked great for RHEL!

Joe


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal