Jump to content

Opt("UserNameMatchMode", 2)


ChromeFan
 Share

Recommended Posts

i have created a program for my dad's office, there are around 50 computers. i want that my script should only work in office computers. all the computers have the same usernames but a bit different. like

A.F.C Traders1

A.F.C Traders2

A.F.C Traders3 and so on...

now i need a solution which can work to stop the script from running if the username is changed.

i have tried this:

if @UserName = "A.F.C Traders1" Then
    MsgBox(0, "Welcome", "Thanks for using this program", 10)
Else
    MsgBox(0, "You are Restricted", "This Program is only For A.F.C Companies")
    Exit
EndIf

but how can i add more names? and what if the company will add more computers to use this program?

then they will be not able to run this tool.

i need a idea which will match the UserName with "A.F.C" and run the script Else Exit.

for example if the Username will Contain "A.F.C" world then script will Run otherwise Not.

Thanks!

Edited by ChromeFan
Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel
Link to comment
Share on other sites

I'm guessing this would be an approach

$UserName=@UserName
if StringRegExp($UserName,"A.F.C Traders[0-9](.*?)")    Then
    MsgBox(0, "Welcome", "Thanks for using this program", 10)
Else
    MsgBox(0, "You are Restricted", "This Program is only For A.F.C Companies")
;~   Exit
EndIf

$UserName="A.F.C Traders2"
if StringRegExp($UserName,"A.F.C Traders[0-9](.*?)")    Then
    MsgBox(0, "Welcome", "Thanks for using this program", 10)
Else
    MsgBox(0, "You are Restricted", "This Program is only For A.F.C Companies")
;~   Exit
EndIf

$UserName="A.F.C Traders15"
if StringRegExp($UserName,"A.F.C Traders[0-9](.*?)")    Then
    MsgBox(0, "Welcome", "Thanks for using this program", 10)
Else
    MsgBox(0, "You are Restricted", "This Program is only For A.F.C Companies")
;~   Exit
EndIf
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...