I was playing with CVAL and GETVAL commands this weekend and submit the code below to the list. It's simple but gives some valuable info. It displays computer name, RBase Username, Net User name, RBase User ID, Win UserID, number of active adapters (up to 3) and the IP and MAC address of each. The code is based on the (GETVAL('GetIPAddress','n')) help screen, so credit is due to Razzak, Dream Team & editor of the Command Syntax help screens. I just added some CVALs. The only limitation (in 7.6) was length of the Pause Message expression, so it displays IP & MAC info for 3 adapters, not 4 that it did in the help example.

Hope it's helpful. I use the code in a custom EEP in a "Utilities" Group Bar Item in a Main Menu.

Doug

--CompUserInfo
--2/19/08:DHH

CLEAR VARIABLE +
vActiveAdapters, +
vCaption, +
vIPAddress1,vIPAddress2, vIPAddress3, +
vMACAddrs, +
vMACAddr1,vMACAddr2,vMACAddr3, +
vPauseMessage

SET VAR vPauseMessage TEXT = NULL
SET VAR vCaption TEXT = 'R:Base Computer and User info'
-- To retrieve the number of active network adapters
SET VAR vActiveAdapters TEXT = (GETVAL('GetIPAddress','0'))
-- To retrieve the IP addresses of active network adapters
SET VAR vIPAddress1 TEXT = (GETVAL('GetIPAddress','1'))
SET VAR vIPAddress2 TEXT = (GETVAL('GetIPAddress','2'))
SET VAR vIPAddress3 TEXT = (GETVAL('GetIPAddress','3'))

-- To retrieve the MAC addresses of active network adapters
SET VAR vMACAddrs TEXT = (GETVAL('GetMACAddr','0'))
SET VAR vMACAddr1 TEXT = (GETVAL('GetMACAddr','1'))
SET VAR vMACAddr2 TEXT = (GETVAL('GetMACAddr','2'))
SET VAR vMACAddr3 TEXT = (GETVAL('GetMACAddr','3'))

SET VAR vPauseMessage = +
 ('Computer:'+(CHAR(009))&(CVAL('COMPUTER'))+ +
 (CHAR(009))+(CHAR(013))+ +
 'RBase User:  '+(CHAR(009))&(CVAL('NAME'))+ +
 (CHAR(009))+(CHAR(013))+ +
 'Net User:    '+(CHAR(009))&(CVAL('NETUSER'))+ +
 (CHAR(009))+(CHAR(013))+ +
 'RBase UserID:'+(CHAR(009))&(CVAL('USER'))+ +
 (CHAR(009))+(CHAR(013))+ +
 'Win UserID:  '+(CHAR(009))&(CVAL('USERID'))+ +
 (CHAR(009))+(CHAR(013))+ +
 'Number of Active Adapter(s):'+(CHAR(009))&.vActiveAdapters+ +
 (CHAR(009))+(CHAR(013))+ +
 'IP Address 1:'+(CHAR(009))&.vIPAddress1+ +
 (CHAR(009))+(CHAR(013))+ +
 'MAC Addr 1:'+(CHAR(009))&.vMACAddr1+ +
 (CHAR(009))+(CHAR(013))+ +
 'IP Address 2:'+(CHAR(009))&.vIPAddress2+ +
 (CHAR(009))+(CHAR(013))+ +
 'MAC Addr 2:'+(CHAR(009))&.vMACAddr2+ +
 (CHAR(009))+(CHAR(013))+ +
 'IP Address 3:'+(CHAR(009))&.vIPAddress3+ +
 (CHAR(009))+(CHAR(013))+ +
 'MAC Addr 3:'+(CHAR(009))&.vMACAddr3+ +
 (CHAR(009))+(CHAR(013)))
CLS

PAUSE 2 USING .vPauseMessage CAPTION .vCaption +
ICON APP +
BUTTON 'R:Base - always having fun!' +
OPTION BACK_COLOR WHITE +
|MESSAGE_COLOR WHITE +
|MESSAGE_FONT_COLOR GREEN +
|BUTTON_COLOR WHITE
CLS

CLEAR VARIABLE +
vActiveAdapters, +
vCaption, +
vIPAddress1,vIPAddress2,vIPAddress3, +
vMACAddrs, +
vMACAddr1,vMACAddr2,vMACAddr3, +
vPauseMessage

RETURN


Reply via email to