nyirog 0 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? Share this post Link to post Share on other sites
Juvigy 49 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 Share this post Link to post Share on other sites
JohnOne 1,603 Posted December 16, 2010 @UserName AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Share this post Link to post Share on other sites
nyirog 0 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?) Share this post Link to post Share on other sites
Juvigy 49 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 Share this post Link to post Share on other sites