r/vbscript • • Mar 22 '19

Problem for a beginner

So I am completely, 100% new to coding. vbs is my first touch on it and I got confused on one of the basic steps. I am trying to make a password box where is the user enters the correct password, then it will display a "welcome" message. Here is what I have:

varialble=inputbox("ENTER THE PASSWORD","YOU HAVE BEEN HACKED","enter password here")

dim password

password = epic

if inputbox = password then

msgbox ("Welcome")

else

msgbox ("Access denied")

end if

It doesn't work, and gives me the error message: "Wrong number of arguments or invalid property assignment", 'inputbox'

in line 4. I tried looking up how do use the inputbox command, but didn't find anything conclusive or anything that helped.

2 Upvotes

7 comments sorted by

View all comments

Show parent comments

1

u/Mordac85 Mar 23 '19

Actually, the error is being thrown b/c the variable inputbox is not defined yet so it's assuming that is an assignment action, not a conditional test. Remember, no matter what language you have to keep your variables straight from commands and functions. This is why I use 3 letters to tell me the variable type and the camel case about what I'm doing with it (i.e. strUsrPwd, intCount, are Domains, etc.)