Ana içeriğe atla

Get Computer Name with Open Edge

There are three different methot to get computer name.

1. OS-GETENV Function :

MESSAGE 
   OS-GETENV("COMPUTERNAME")           SKIP        
   OS-GETENV("HOSTNAME")               SKIP
VIEW-AS ALERT-BOX INFO BUTTONS OK.

2. Use hostname utility :  (windows only)

DEFINE VARIABLE cHost AS CHARACTER  NO-UNDO.
INPUT THROUGH hostname NO-ECHO.
SET cHost.
INPUT CLOSE. 
 DISPLAY cHost. 

3. Using .NET assemblies ( Also available get Local IP adress ):

DEFINE VARIABLE oIPHostEntry AS System.Net.IPHostEntry NO-UNDO.
DEFINE VARIABLE oIPAddress   AS System.Net.IPAddress   NO-UNDO.
DEFINE VARIABLE cIPAddresses AS CHARACTER              NO-UNDO.
DEFINE VARIABLE iCount       AS INTEGER                NO-UNDO INITIAL 1.

oIPHostEntry = System.Net.Dns:GetHostEntry(System.Net.Dns:GetHostName()).

DO WHILE TRUE:
  oIPAddress = CAST(oIPHostEntry:AddressList:GetValue(iCount),"System.Net.IPAddress") NO-ERROR.
  IF ERROR-STATUS:NUM-MESSAGES GT 0 THEN
    LEAVE.

  cIPAddresses = cIPAddresses + (IF (cIPAddresses GT "") EQ TRUE THEN CHR(10) ELSE "") + oIPAddress:ToString().
  iCount = iCount + 1.
END.

MESSAGE "Host name:  " System.Net.Dns:GetHostName() SKIP
        "Ip Address: " cIPAddresses

    VIEW-AS ALERT-BOX INFO BUTTONS OK.


For more info, to see Progress KB

Yorumlar

Bu blogdaki popüler yayınlar

Generate pasword with OpenEdge command line genpassword utitiy

The 'genpassword' utility is currently only installed for AppServers and development licenses which contain the AdminServer framework It's call ' bin/genpassword.bat'. java base usefull utility for  Password Encrypter for ubroker.properties.  For more information in Progress Documentation . Open the proenv utitiy  and after then run script. genpassword -password text [ -verify encrypted-password ] c:\dlc\prowin32.exe -db test -1 -U test -P oech1::24373c33

OS-GETENV FUNCTION IN OPENEDGE ABL

Get some operating system environment with OpenEdge Abl language MESSAGE     OS-GETENV("COMPUTERNAME")           SKIP            OS-GETENV("HOSTNAME")               SKIP    OS-GETENV("USERNAME")               SKIP    OS-GETENV("OS")                     SKIP    OS-GETENV("HOMEDRIVE")              SKIP    OS-GETENV("PROCESSOR_ARCHITECTURE") SKIP    OS-GETENV("PROCESSOR_IDENTIFIER")   SKIP    OS-GETENV("PROCESSOR_LEVEL")        SKIP    OS-GETENV("PROCESSOR_REVISION")     SKIP    OS-GETENV("HighestNumaNodeNumber")  SKIP    OS-GETENV("ProgramW6432")           SKIP    OS-GETENV("UserDnsDomain")          SKIP    OS-GETENV("WINDIR")                 SKIP    OS-GETENV("PROMPT")                 SKIP    OS-GETENV("LOCALAPPDATA")           SKIP    OS-GETENV("PATH")                   SKIP    OS-GETENV("TEMP").