(GETVAL('GetIPAddress','n'))
Where 'n' is the parameter to either retrieve the number of active network adapters or to retrieve the IP address of a given active network adapter. Use '0' to retrieve the number of active network adapters and 1-9 to retrieve the IP address(es) of active network adapter(s) of a given network workstation/server.
Example:
-- Start
-- GetIPAddress.RMD
CLS
CLEAR VARIABLE vActiveAdapters,vIPAddress1,vIPAddress2, +
vIPAddress3,vIPAddress4,vPauseMessage,vCaption
SET VAR vActiveAdapters TEXT = NULL
SET VAR vIPAddress1 TEXT = NULL
SET VAR vIPAddress2 TEXT = NULL
SET VAR vIPAddress3 TEXT = NULL
SET VAR vIPAddress4 TEXT = NULL
SET VAR vPauseMessage TEXT = NULL
SET VAR vCaption TEXT = 'Understanding New GETVAL Function'
-- To retrieve the number of active network adapters
SET VAR vActiveAdapters = (GETVAL('GetIPAddress','0'))
-- To retrieve the IP address of first active network adapter
SET VAR vIPAddress1 = (GETVAL('GetIPAddress','1'))
-- To retrieve the IP address of second active network adapter
SET VAR vIPAddress2 = (GETVAL('GetIPAddress','2'))
-- To retrieve the IP address of third active network adapter
SET VAR vIPAddress3 = (GETVAL('GetIPAddress','3'))
-- To retrieve the IP address of fourth active network adapter
SET VAR vIPAddress4 = (GETVAL('GetIPAddress','4'))
SET VAR vPauseMessage = +
('Number of Active Adapter(s):'+(CHAR(009))&.vActiveAdapters+ +
(CHAR(009))+(CHAR(013))+ +
'IP Address of Active Adapter 1:'+(CHAR(009))&.vIPAddress1+ +
(CHAR(009))+(CHAR(013))+ +
'IP Address of Active Adapter 2:'+(CHAR(009))&.vIPAddress2+ +
(CHAR(009))+(CHAR(013))+ +
'IP Address of Active Adapter 3:'+(CHAR(009))&.vIPAddress3+ +
(CHAR(009))+(CHAR(013))+ +
'IP Address of Active Adapter 4:'+(CHAR(009))&.vIPAddress4+ +
(CHAR(009))+(CHAR(013)))
CLS
PAUSE 2 USING .vPauseMessage CAPTION .vCaption +
ICON APP +
Button 'Yes, this is the R:BASE you have always wanted!' +
OPTION BACK_COLOR WHITE +
|MESSAGE_COLOR WHITE +
|MESSAGE_FONT_COLOR GREEN +
|BUTTON_COLOR WHITE
CLS
CLEAR VARIABLE vActiveAdapters,vIPAddress1,vIPAddress2, +
vIPAddress3,vIPAddress4,vPauseMessage,vCaption
RETURN
-- end