取消
显示结果 
搜索替代 
您的意思是: 

Scan string for computer user name

已解决!
转到解答

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 项奖励
1 条消息(共 5 条)
2,884 次查看
解答
接受人 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 项奖励
2 条消息(共 5 条)
2,866 次查看

I don't have LV2011.

 

Have you seen this Knowledgebase article?

 

Programmatically Retrieving a Windows User Name in LabVIEW

 

 

0 项奖励
3 条消息(共 5 条)
2,863 次查看

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 项奖励
4 条消息(共 5 条)
2,856 次查看

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

Hopefully should work as you are expecting.

0 项奖励
5 条消息(共 5 条)
2,847 次查看