To get the localhost name and username within idl, you can use the get_login_info function.
IDL>help,/str, get_login_info()
** Structure <88f5c88>, 2 tags, length=24, data length=24,
refs=1:
MACHINE_NAME STRING 'PSGJPENDLETON'
USER_NAME STRING 'jimp'