At 01:43 PM 10/26/2005, Frank Taylor wrote:

Is there a CVAL or GETVAL command that will return the
IP address of the computer the user is on ?


Frank,

Did you know that you can use the (GETVAL('GetIPAddress','n'))
function in R:BASE 7.5 for Windows (Update 22) to retrieve
the IP Address(es) for any given network adapter(s) of a
given workstation or server?

Syntax:

(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

That's all there is to it!

Very Best R:egards,

Razzak.

Reply via email to