Jump to content

Recommended Posts

Posted

quick question.

how can i put a condition at the top of the script that says:

if current_user is not (then list of account names) then

msgbox "ur not allowed to use this script"

exit

endif

something along those lines?

Posted

quick question.

how can i put a condition at the top of the script that says:

if current_user is not (then list of account names) then

msgbox "ur not allowed to use this script"

exit

endif

something along those lines?

Here's a quick and dirty. Just remember to update the 0 index in the array (and the array initialization count) to reflect the number of users in the list.

Dim $aAuthorizedUsers[5] = ["4","User01","User02","User03","User04"]
$iAuthorized = 0

For $i = 1 To $aAuthorizedUsers[0]
    If @UserName = $aAuthorizedUsers[$i] Then
        $iAuthorized = 1
        ExitLoop
    EndIf
Next

If Not $iAuthorized Then
    MsgBox(16,"Access Denied - Invalid Account","You are not authorized to use this application." &@CRLF &@CRLF &"Exiting...",5)
    Exit(5)
EndIf

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Posted

that wont support multiple users tho right?

If Not @Username = $Username Then

Msgbox(0, "You Cannot", "Use This Script", 2)

Exit

Endif

Posted

ill give it a whirl!

thanks!

Here's a quick and dirty. Just remember to update the 0 index in the array (and the array initialization count) to reflect the number of users in the list.

Dim $aAuthorizedUsers[5] = ["4","User01","User02","User03","User04"]
$iAuthorized = 0

For $i = 1 To $aAuthorizedUsers[0]
    If @UserName = $aAuthorizedUsers[$i] Then
        $iAuthorized = 1
        ExitLoop
    EndIf
Next

If Not $iAuthorized Then
    MsgBox(16,"Access Denied - Invalid Account","You are not authorized to use this application." &@CRLF &@CRLF &"Exiting...",5)
    Exit(5)
EndIf

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
×
×
  • Create New...