JonCross Posted October 26, 2009 Share Posted October 26, 2009 (edited) I have a script that I only want run on "Student" computers at my school. so I want to be able to make an INF file that contains user names that the script will look at for user names. Below is what I have for now, but I want to be able to add more user names. Any ideas? IF @username = "rc-felazarov" Then Else MSGBox(48,"ATTENTION", "Please run this scrip on only student accounts!") Exit EndIF Edited October 26, 2009 by JonCross Link to comment Share on other sites More sharing options...
GEOSoft Posted October 26, 2009 Share Posted October 26, 2009 Create a text file with the user names all on separate lines rc-felazarov gp-someone an-onymous and name it users.txt If NOT StringRegExp(FileRead(@ScriptDir & "\users.txt"), "(?m:^)" & @UserName & "\v|$") Then MSGBox(48,"ATTENTION", "Please run this scrip on only student accounts!") Exit EndIf George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Mat Posted October 26, 2009 Share Posted October 26, 2009 Use a text file like: Mat JonCross MyUsername User3452345 User337234 and this function: MsgBox (0, "MyUsername", _CheckUser ("MyUsername")) Func _CheckUser ($sUsername = @Username) Return StringRegExp (FileRead (@ScriptDir & "Usernames.txt"), "(?i)(?:\n|\r|\A)(\Q" & $sUsername & "\E)(?:\n|\r|\z)", 0) EndFunc ; ==> _CheckUser Which just checks to see if the specified user exists on a line. Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
GEOSoft Posted October 27, 2009 Share Posted October 27, 2009 Why are you falling into the trap of over complicating the SRE? George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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