Sign in to follow this  
Followers 0
ChromeFan

Opt("UserNameMatchMode", 2)

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



StringInStr(@UserName,"A.F.C")

?

:)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0