Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Why is my VBScript not logging in properly? This .vbs script should open reddit

ID: 3908941 • Letter: W

Question

Why is my VBScript not logging in properly?

This .vbs script should open reddit and automatically login. Instead I get an error stating I need an object? (The username and password fields are not an actual account).

Set objIE = CreateObject("InternetExplorer.Application")

Call objIE.navigate("https://old.reddit.com")

objIE.Visible = True

Do Until objIE.ReadyState = 4 : Call WScript.Sleep(100) : Loop

With objIE.Document
.getElementByID("user").value = "username"
.getElementByID("passwd").value = "mypass"
.getElementByID("submit").submit

End With

Explanation / Answer

Solution:

You are facing this error because the login credentials which you are sending needs to be in the form of an object.

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote