Cyborg5000 Posted April 30, 2018 Share Posted April 30, 2018 Tried with Global $user = 'user1' And 'user2' And 'user3' And 'user4' Also Global $user = 'user1' Or'user2' Or'user3' Or 'user4' Global $userid = GUICtrlRead($USERIDINPUT) If Not $user == $userid Then MsgBox(0, "Temp", "You can run the script") Else MsgBox(0, "Temp", "You cannot run the script") Exit EndIf Link to comment Share on other sites More sharing options...
Cyborg5000 Posted April 30, 2018 Author Share Posted April 30, 2018 Also tried Global $user = 'user1' Or'user2' Or'user3' Or 'user4' Global $userid = GUICtrlRead($USERIDINPUT) If $user = $userid Then OR $userid = $user Then MsgBox(0, "Temp", "You can run the script") Else MsgBox(0, "Temp", "You cannot run the script") Exit EndIf Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 30, 2018 Moderators Share Posted April 30, 2018 Moved to the correct forum, as the DEV forum very clearly states: Quote Do not create AutoIt-related topics here, use AutoIt General Help and Support... "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Developers Jos Posted April 30, 2018 Developers Share Posted April 30, 2018 23 minutes ago, Cyborg5000 said: Global $user = 'user1' And 'user2' And 'user3' And 'user4' Also Global $user = 'user1' Or'user2' Or'user3' Or 'user4' I am wondering why you think this should work at all? You are creating an boolean result to which $User will be set. One way is to do it like this: Global $user = '|user1|user2|user3|user4|' If StringInStr($user, "|" & $userid & "|") Then ; EndIf also for the records: these kind of tests will always fail: 28 minutes ago, Cyborg5000 said: If Not $user == $userid Then as Not $user will be evaluated as first step! Jos Cyborg5000 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
water Posted April 30, 2018 Share Posted April 30, 2018 You could have a look at Xprotec in the example scripts section to limit access to your script. But be aware that you can not get 100% protection - search the forum for explanations why My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted April 30, 2018 Share Posted April 30, 2018 (edited) If you are having them log into the computer @UserName is great as it authenticates against who they are logged in as, nobody can simply just type somebody elses name into a field. You can then check against a AD security group with other AD integration UDF that we have. At the most basic level, I would put my names in an .ini file or in the script as an array and check it in a loop with stringinstr() or stringregexp() depending how secure you want it and how easy to modify it needs to be. Edited April 30, 2018 by ViciousXUSMC 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