From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scan string for computer user name

Solved!
Go to solution

Good morning NI Forums,

 

I need direction on a file path scan. I'm trying to get to the user name on any system, primarily XP or 7. I'd like to compare the user name from the "Get System Directory" VI with a constant user name.This way I can pass that to a case structure and close LabVIEW if the computer is logged into the wrong user (there are network read/write permissions which is why I need to control where the program isrun from). Any suggestions for the format string constant or maybe a better mouse trap?

 

I've attached my VI for reference.

 

Thanks!

Tyler C. | Certified LabVIEW Associate Developer

0 Kudos
Message 1 of 5
(2,277 Views)
Solution
Accepted by topic author Tyler_C

Hi,

 

We just discussed this on the phone but I am posting the solution so that others are aware of the solution. You wanted to check if a known username is the current user of the system (on XP or Windows 7) so we worked up a quick VI

 

2012-01-27_132434.png

 

Regards,

0 Kudos
Message 2 of 5
(2,259 Views)

I don't have LV2011.

 

Have you seen this Knowledgebase article?

 

Programmatically Retrieving a Windows User Name in LabVIEW

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 3 of 5
(2,256 Views)

Phillip,

I hadn't seen that article. I didn't realize a property node could grab the user name. Thanks for the post!

 

Tyler

 

 

Tyler C. | Certified LabVIEW Associate Developer

0 Kudos
Message 4 of 5
(2,249 Views)

Here is updated VI with format string constant and little bit changes in the VI.

Hopefully should work as you are expecting.

0 Kudos
Message 5 of 5
(2,240 Views)