nyirog Posted December 16, 2010 Share Posted December 16, 2010 In our company there are 2 kind of users: the company's own users has a simple username (example abcd, efgh, xyza, etc.), and the vendor users have "a-" before their username (example a-abcd, a-efgh, a-xyza, etc)I would like to prevent my scripts against vendor users. I would have a check: Is the logged on user has an "a-" user, or a simple? If he/she has simple user, the script start normally, but if the username start with "a-" then get an error message. (for example: You are not authorized to run this program)How can I do this? Link to comment Share on other sites More sharing options...
Juvigy Posted December 16, 2010 Share Posted December 16, 2010 For sure there are better ways but some easy way would be to check the %userprofile% variable It holds the username of the currently logged in user. C:\Documents and Settings\username Link to comment Share on other sites More sharing options...
JohnOne Posted December 16, 2010 Share Posted December 16, 2010 @UserName AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
nyirog Posted December 16, 2010 Author Share Posted December 16, 2010 For sure there are better ways but some easy way would be to check the %userprofile% variable It holds the username of the currently logged in user. C:\Documents and Settings\username ok, you are right, i know it, but how can i check this username start with "a-" or not? (maybe read it to a string, but is there a command to check string's first character?) Link to comment Share on other sites More sharing options...
Juvigy Posted December 16, 2010 Share Posted December 16, 2010 (edited) $result = StringLeft(@UserName , 2) MsgBox(0, "Leftmost 2 characters are:", $result) Yes- try this example @edit - small error correction Edited December 16, 2010 by Juvigy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now