DECLARE INTEGER GetUserName IN WIN32API ;
STRING @ lpBuffer, ;
INTEGER @ nSize
nBufLen = 261
cBuffer = SPACE(nBufLen)
IF GetUserName(@cBuffer, @nBufLen) # 0
? LEFT(cBuffer, nBufLen-1) && User name of current thread
ELSE
* something got squirelly
ENDIF
which gets you the Windows user name; if you have the Windows scripting host, available, so does:
oWSHNet = CREATEOBJ('Wscript.Network')
? WSHNet.UserName
>Any help would be appreciated.
>
>THanks.
>
>hld = ""
>hld1 = ""
>If file("Z:\WHOAMI.EXE")
> cmd_str = "Z:\WHOAMI > "+CTEMPPATH+"WHOAMI.TXT"
> Do DosRun with cmd_str
> fhandle = fopen(CTEMPPATH+"WHOAMI.TXT",0)
> tmp = fread(fhandle,60)
> tmp = substr(tmp,5,len(tmp))
> =fclose(fhandle)
>
> If not empty(tmp)
> hld1 = ATC("@", tmp)
> If hld1 = 0
> street_talk = ""
> Else
> nPos = hld1-1
> street_talk = Left(tmp,nPos)
> return street_talk
> Endif
> Endif
>
>
>Else
> hld = ""
> street_talk = ""
> return hld
>EndifEMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater
NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC
The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys