LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Take the user and turn it into a string

Solved!
Go to solution

Hello All:

 

I'd like to be able to take the user name from the computer (who is logged in) and bring it into the VI, preferably as a string.

0 Kudos
Message 1 of 4
(2,266 Views)
Solution
Accepted by topic author Throggdor

Looked through the application property nodes? Smiley Wink

 

Message 2 of 4
(2,260 Views)

I was trying to use this https://decibel.ni.com/content/docs/DOC-24358

but I couldnt get it to work right I kept getting an error code 1018 "GetCurrentUserName.vi<ERR>
Win API Call "GetUserNameEx" failed."

 

But your soultion works too, and its less cumberson since I dont have to call a dll. Thanks man.

0 Kudos
Message 3 of 4
(2,251 Views)

Just be aware that the returned value is the user that launched the program - A "Run as Administrator" will return a different value than the user that's logged in.  That's where the Win API call is helpful, that'll return the user that's logged in regardless of who launches the application.

 

But if it's not a big deal, the property node certainly is an easier solution.

0 Kudos
Message 4 of 4
(2,235 Views)